HTML Parser Home Page

org.htmlparser.filters
Class OrFilter

java.lang.Object
  extended by org.htmlparser.filters.OrFilter
All Implemented Interfaces:
Serializable, Cloneable, NodeFilter

public class OrFilter
extends Object
implements NodeFilter

Accepts nodes matching any of its predicates filters (OR operation).

See Also:
Serialized Form

Field Summary
protected  NodeFilter[] mPredicates
          The predicates that are to be or'ed together;
 
Constructor Summary
OrFilter()
          Creates a new instance of an OrFilter.
OrFilter(NodeFilter[] predicates)
          Creates an OrFilter that accepts nodes acceptable to any of the given filters.
OrFilter(NodeFilter left, NodeFilter right)
          Creates an OrFilter that accepts nodes acceptable to either filter.
 
Method Summary
 boolean accept(Node node)
          Accept nodes that are acceptable to any of its predicate filters.
 NodeFilter[] getPredicates()
          Get the predicates used by this OrFilter.
 void setPredicates(NodeFilter[] predicates)
          Set the predicates for this OrFilter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPredicates

protected NodeFilter[] mPredicates
The predicates that are to be or'ed together;

Constructor Detail

OrFilter

public OrFilter()
Creates a new instance of an OrFilter. With no predicates, this would always answer false to accept(org.htmlparser.Node).

See Also:
setPredicates(org.htmlparser.NodeFilter[])

OrFilter

public OrFilter(NodeFilter left,
                NodeFilter right)
Creates an OrFilter that accepts nodes acceptable to either filter.

Parameters:
left - One filter.
right - The other filter.

OrFilter

public OrFilter(NodeFilter[] predicates)
Creates an OrFilter that accepts nodes acceptable to any of the given filters.

Parameters:
predicates - The list of filters.
Method Detail

getPredicates

public NodeFilter[] getPredicates()
Get the predicates used by this OrFilter.

Returns:
The predicates currently in use.

setPredicates

public void setPredicates(NodeFilter[] predicates)
Set the predicates for this OrFilter.

Parameters:
predicates - The list of predidcates to use in accept(org.htmlparser.Node).

accept

public boolean accept(Node node)
Accept nodes that are acceptable to any of its predicate filters.

Specified by:
accept in interface NodeFilter
Parameters:
node - The node to check.
Returns:
true if any of the predicate filters find the node is acceptable, false otherwise.

© 2006 Derrick Oswald
Sep 17, 2006

HTML Parser is an open source library released under Common Public License. SourceForge.net