Package org.htmlparser.filters
Class AndFilter
- java.lang.Object
-
- org.htmlparser.filters.AndFilter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,NodeFilter
public class AndFilter extends java.lang.Object implements NodeFilter
Accepts nodes matching all of its predicate filters (AND operation).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NodeFilter[]mPredicatesThe predicates that are to be and'ed together;
-
Constructor Summary
Constructors Constructor Description AndFilter()Creates a new instance of an AndFilter.AndFilter(NodeFilter[] predicates)Creates an AndFilter that accepts nodes acceptable to all given filters.AndFilter(NodeFilter left, NodeFilter right)Creates an AndFilter that accepts nodes acceptable to both filters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(Node node)Accept nodes that are acceptable to all of its predicate filters.NodeFilter[]getPredicates()Get the predicates used by this AndFilter.voidsetPredicates(NodeFilter[] predicates)Set the predicates for this AndFilter.
-
-
-
Field Detail
-
mPredicates
protected NodeFilter[] mPredicates
The predicates that are to be and'ed together;
-
-
Constructor Detail
-
AndFilter
public AndFilter()
Creates a new instance of an AndFilter. With no predicates, this would always answertruetoaccept(org.htmlparser.Node).
-
AndFilter
public AndFilter(NodeFilter left, NodeFilter right)
Creates an AndFilter that accepts nodes acceptable to both filters.- Parameters:
left- One filter.right- The other filter.
-
AndFilter
public AndFilter(NodeFilter[] predicates)
Creates an AndFilter that accepts nodes acceptable to all given filters.- Parameters:
predicates- The list of filters.
-
-
Method Detail
-
getPredicates
public NodeFilter[] getPredicates()
Get the predicates used by this AndFilter.- Returns:
- The predicates currently in use.
-
setPredicates
public void setPredicates(NodeFilter[] predicates)
Set the predicates for this AndFilter.- Parameters:
predicates- The list of predidcates to use inaccept(org.htmlparser.Node).
-
accept
public boolean accept(Node node)
Accept nodes that are acceptable to all of its predicate filters.- Specified by:
acceptin interfaceNodeFilter- Parameters:
node- The node to check.- Returns:
trueif all the predicate filters find the node is acceptable,falseotherwise.
-
-