[Htmlparser-cvs] htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers AndFilterWr
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2005-04-12 11:27:53
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers Modified Files: AndFilterWrapper.java HasAttributeFilterWrapper.java HasChildFilterWrapper.java HasParentFilterWrapper.java HasSiblingFilterWrapper.java NodeClassFilterWrapper.java NotFilterWrapper.java OrFilterWrapper.java RegexFilterWrapper.java StringFilterWrapper.java TagNameFilterWrapper.java Log Message: Documentation revamp part two. Index: HasParentFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasParentFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasParentFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasParentFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 43,49 **** */ public class HasParentFilterWrapper ! extends ! Filter ! implements ActionListener { --- 43,49 ---- */ public class HasParentFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 85,88 **** --- 85,92 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 90,93 **** --- 94,101 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 95,98 **** --- 103,110 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 110,113 **** --- 122,133 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 116,119 **** --- 136,143 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 138,141 **** --- 166,179 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 161,170 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setParentFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 199,208 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setParentFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 176,179 **** --- 214,226 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 187,190 **** --- 234,238 ---- /** * Invoked when an action occurs on the check box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 197,201 **** { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } --- 245,249 ---- { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } Index: NotFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/NotFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NotFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- NotFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class NotFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class NotFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 91,94 **** --- 103,114 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 96,99 **** --- 116,123 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 110,113 **** --- 134,141 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 118,121 **** --- 146,159 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 135,144 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicate ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 173,182 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicate ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 150,153 **** --- 188,200 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { Index: StringFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/StringFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StringFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- StringFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 50,56 **** */ public class StringFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener, --- 50,56 ---- */ public class StringFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener, *************** *** 62,68 **** protected StringFilter mFilter; ! /** ! * Text to check for. ! */ protected JTextArea mPattern; --- 62,68 ---- protected StringFilter mFilter; ! /** ! * Text to check for. ! */ protected JTextArea mPattern; *************** *** 110,117 **** { mLocale.addItem (mFilter.getLocale ().getDisplayName ()); ! thread = new Thread (this); ! thread.setName ("locale_getter"); ! thread.setPriority (Thread.MIN_PRIORITY); ! thread.run (); } add (mLocale); --- 110,117 ---- { mLocale.addItem (mFilter.getLocale ().getDisplayName ()); ! thread = new Thread (this); ! thread.setName ("locale_getter"); ! thread.setPriority (Thread.MIN_PRIORITY); ! thread.run (); } add (mLocale); *************** *** 125,128 **** --- 125,132 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 130,133 **** --- 134,141 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 135,138 **** --- 143,150 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 147,150 **** --- 159,170 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 156,159 **** --- 176,183 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 161,164 **** --- 185,192 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 166,169 **** --- 194,207 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 206,209 **** --- 244,256 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 217,220 **** --- 264,268 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 228,235 **** if (source == mCaseSensitivity) { ! sensitive = mCaseSensitivity.isSelected (); ! mFilter.setCaseSensitive (sensitive); mLocale.setVisible (!sensitive); ! mLocale.setSelectedItem (mFilter.getLocale ().getDisplayName ()); } else if (source == mLocale) --- 276,283 ---- if (source == mCaseSensitivity) { ! sensitive = mCaseSensitivity.isSelected (); ! mFilter.setCaseSensitive (sensitive); mLocale.setVisible (!sensitive); ! mLocale.setSelectedItem (mFilter.getLocale ().getDisplayName ()); } else if (source == mLocale) *************** *** 237,248 **** synchronized (mLocale) { ! selection = mLocale.getSelectedObjects (); ! if ((null != selection) && (0 != selection.length)) ! { ! locale = (String)selection[0]; ! for (int i = 0; i < mLocales.length; i++) ! if (locale.equals (mLocales[i].getDisplayName ())) ! mFilter.setLocale (mLocales[i]); ! } } } --- 285,296 ---- synchronized (mLocale) { ! selection = mLocale.getSelectedObjects (); ! if ((null != selection) && (0 != selection.length)) ! { ! locale = (String)selection[0]; ! for (int i = 0; i < mLocales.length; i++) ! if (locale.equals (mLocales[i].getDisplayName ())) ! mFilter.setLocale (mLocales[i]); ! } } } *************** *** 252,256 **** // Runnable interface // ! public void run() { String locale; --- 300,308 ---- // Runnable interface // ! ! /** ! * Background thread task to get the available locales. ! */ ! public void run () { String locale; *************** *** 260,267 **** mLocales = Locale.getAvailableLocales (); locale = mFilter.getLocale ().getDisplayName (); ! for (int i = 0; i < mLocales.length; i++) ! if (!locale.equals (mLocales[i].getDisplayName ())) ! mLocale.addItem (mLocales[i].getDisplayName ()); ! mLocale.invalidate (); } } --- 312,319 ---- mLocales = Locale.getAvailableLocales (); locale = mFilter.getLocale ().getDisplayName (); ! for (int i = 0; i < mLocales.length; i++) ! if (!locale.equals (mLocales[i].getDisplayName ())) ! mLocale.addItem (mLocales[i].getDisplayName ()); ! mLocale.invalidate (); } } *************** *** 271,274 **** --- 323,330 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 286,289 **** --- 342,349 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 301,304 **** --- 361,368 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: HasChildFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasChildFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasChildFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasChildFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 43,49 **** */ public class HasChildFilterWrapper ! extends ! Filter ! implements ActionListener { --- 43,49 ---- */ public class HasChildFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 85,88 **** --- 85,92 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 90,93 **** --- 94,101 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 95,98 **** --- 103,110 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 110,113 **** --- 122,133 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 116,119 **** --- 136,143 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 138,141 **** --- 166,179 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 161,170 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setChildFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 199,208 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setChildFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 176,179 **** --- 214,226 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 187,190 **** --- 234,238 ---- /** * Invoked when an action occurs on the check box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 197,201 **** { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } --- 245,249 ---- { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } Index: AndFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/AndFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AndFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- AndFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class AndFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class AndFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 94,97 **** --- 106,117 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 99,102 **** --- 119,126 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 104,107 **** --- 128,135 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 109,112 **** --- 137,150 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 126,147 **** } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; --- 164,185 ---- } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; *************** *** 153,162 **** if (0 != predicates.length) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicates ("); ! out.append (array); ! out.append (");"); ! newline (out); } --- 191,200 ---- if (0 != predicates.length) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicates ("); ! out.append (array); ! out.append (");"); ! newline (out); } *************** *** 168,171 **** --- 206,218 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { Index: HasSiblingFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasSiblingFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasSiblingFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 41,46 **** */ public class HasSiblingFilterWrapper ! extends ! Filter implements ActionListener --- 41,46 ---- */ public class HasSiblingFilterWrapper ! extends ! Filter implements ActionListener *************** *** 72,75 **** --- 72,79 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 77,80 **** --- 81,88 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 82,85 **** --- 90,97 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 96,99 **** --- 108,119 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 101,104 **** --- 121,128 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 115,118 **** --- 139,146 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 123,126 **** --- 151,164 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 140,149 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setSiblingFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 178,187 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setSiblingFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 155,158 **** --- 193,205 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 166,169 **** --- 213,217 ---- /** * Invoked when an action occurs. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) Index: TagNameFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/TagNameFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TagNameFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- TagNameFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 50,56 **** */ public class TagNameFilterWrapper ! extends ! Filter ! implements ActionListener { --- 50,56 ---- */ public class TagNameFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 84,87 **** --- 84,91 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 89,92 **** --- 93,100 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 94,97 **** --- 102,109 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 104,107 **** --- 116,127 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 113,118 **** try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addName (set, iterator.nextNode ()); } catch (ParserException pe) --- 133,138 ---- try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addName (set, iterator.nextNode ()); } catch (ParserException pe) *************** *** 125,128 **** --- 145,152 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 135,138 **** --- 163,176 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 155,158 **** --- 193,201 ---- } + /** + * Add the tag name and it's children's tag names to the set of tag names. + * @param set The set to add to. + * @param node The node to get the names from. + */ protected void addName (Set set, Node node) { *************** *** 175,178 **** --- 218,230 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 186,189 **** --- 238,242 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) Index: NodeClassFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/NodeClassFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeClassFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- NodeClassFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 51,57 **** */ public class NodeClassFilterWrapper ! extends ! Filter ! implements ActionListener // , --- 51,57 ---- */ public class NodeClassFilterWrapper ! extends ! Filter ! implements ActionListener // , *************** *** 86,89 **** --- 86,93 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 91,94 **** --- 95,102 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 96,99 **** --- 104,111 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 106,109 **** --- 118,129 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 132,135 **** --- 152,159 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 137,140 **** --- 161,168 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 142,145 **** --- 170,183 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 167,170 **** --- 205,217 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 178,181 **** --- 225,229 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 189,196 **** mFilter.setMatchClass (Class.forName ((String)mClass.getSelectedItem ())); } ! catch (ClassNotFoundException cnfe) ! { ! cnfe.printStackTrace (); ! } } --- 237,244 ---- mFilter.setMatchClass (Class.forName ((String)mClass.getSelectedItem ())); } ! catch (ClassNotFoundException cnfe) ! { ! cnfe.printStackTrace (); ! } } Index: HasAttributeFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasAttributeFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasAttributeFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 59,65 **** */ public class HasAttributeFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener --- 59,65 ---- */ public class HasAttributeFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener *************** *** 80,86 **** protected JCheckBox mValued; ! /** ! * Value to check for. ! */ protected JTextArea mAttributeValue; --- 80,86 ---- protected JCheckBox mValued; ! /** ! * Value to check for. ! */ protected JTextArea mAttributeValue; *************** *** 123,126 **** --- 123,131 ---- // + /** + * Add the attribute names from the node to the set of attribute names. + * @param set The set to add to. + * @param node The node with attributes to add. + */ protected void addAttributes (Set set, Node node) { *************** *** 150,153 **** --- 155,163 ---- } + /** + * Add the attribute values from the node to the set of attribute values. + * @param set The set to add to. + * @param node The node with attributes to add. + */ protected void addAttributeValues (Set set, Node node) { *************** *** 184,187 **** --- 194,201 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 189,192 **** --- 203,210 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 194,197 **** --- 212,219 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 205,208 **** --- 227,238 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 216,221 **** try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addAttributes (set, iterator.nextNode ()); } catch (ParserException pe) --- 246,251 ---- try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addAttributes (set, iterator.nextNode ()); } catch (ParserException pe) *************** *** 242,245 **** --- 272,279 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 247,250 **** --- 281,288 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 252,255 **** --- 290,303 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 270,279 **** if (null != mFilter.getAttributeValue ()) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setAttributeValue (\""); ! out.append (mFilter.getAttributeValue ()); ! out.append ("\");"); ! newline (out); } --- 318,327 ---- if (null != mFilter.getAttributeValue ()) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setAttributeValue (\""); ! out.append (mFilter.getAttributeValue ()); ! out.append ("\");"); ! newline (out); } *************** *** 285,288 **** --- 333,345 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 296,299 **** --- 353,357 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 312,327 **** else if (source == mValued) { ! valued = mValued.isSelected (); ! if (valued) ! { ! mFilter.setAttributeValue (mAttributeValue.getText ()); ! mAttributeValue.setVisible (true); ! } ! else ! { ! mAttributeValue.setVisible (false); ! mAttributeValue.setText (""); ! mFilter.setAttributeValue (null); ! } } } --- 370,385 ---- else if (source == mValued) { ! valued = mValued.isSelected (); ! if (valued) ! { ! mFilter.setAttributeValue (mAttributeValue.getText ()); ! mAttributeValue.setVisible (true); ! } ! else ! { ! mAttributeValue.setVisible (false); ! mAttributeValue.setText (""); ! mFilter.setAttributeValue (null); ! } } } *************** *** 331,334 **** --- 389,396 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 346,349 **** --- 408,415 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 361,364 **** --- 427,434 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: RegexFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/RegexFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RegexFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- RegexFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 48,54 **** */ public class RegexFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener --- 48,54 ---- */ public class RegexFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener *************** *** 77,83 **** protected RegexFilter mFilter; ! /** ! * Text to check for ! */ protected JTextArea mPattern; --- 77,83 ---- protected RegexFilter mFilter; ! /** ! * Text to check for ! */ protected JTextArea mPattern; *************** *** 115,118 **** --- 115,122 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 120,123 **** --- 124,131 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 125,128 **** --- 133,140 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 136,139 **** --- 148,159 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 143,146 **** --- 163,170 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 148,151 **** --- 172,179 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 153,156 **** --- 181,194 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 179,182 **** --- 217,225 ---- } + /** + * Convert the regex strategy to a string. + * @param strategy The regex strategy. + * @return A string for display in the GUI or in the Java program. + */ public String strategyToString (int strategy) { *************** *** 187,190 **** --- 230,238 ---- } + /** + * Convert a string to a regex strategy. + * @param strategy The string equivalent of a regex strategy. + * @return The regex strategy to use in executing the regular expression. + */ public int stringToStrategy (String strategy) { *************** *** 195,198 **** --- 243,251 ---- } + /** + * Convert the regex strategy to an index into the map. + * @param strategy The regex strategy. + * @return The index of the regex strategy in the map. + */ public int strategyToIndex (int strategy) { *************** *** 203,206 **** --- 256,264 ---- } + /** + * Convert an index into a regex strategy. + * @param index The index of the regex strategy in the map. + * @return The regex strategy at that inxdex. + */ public int indexToStrategy (int index) { *************** *** 212,215 **** --- 270,282 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 223,226 **** --- 290,294 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 237,240 **** --- 305,312 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 252,255 **** --- 324,331 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 267,270 **** --- 343,350 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: OrFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/OrFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- OrFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class OrFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class OrFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 94,97 **** --- 106,117 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 99,102 **** --- 119,126 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 104,107 **** --- 128,135 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 109,112 **** --- 137,150 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 126,147 **** } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; --- 164,185 ---- } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.leng... [truncated message content] |