public class NodeFilter extends MaskFilter
Content
for a complete list of predefined content types.
These are provided as public constants, for ease of use in client programs.
NodeFilter has an accept(Content)
method, which returns true,
if the type of the Content is accepted by the NodeFilter. Internally,
filtering is performed by testing the bit-pattern of each content-type
value against the NodeFilter's internal bit-mask. A bit-pattern is
accepted if it is unchanged by bitwise-AND with the NodeFilter's mask.
mask
ALLCONTENT, NAMENODES, PARENTNODES, PROPERTYNODES, VALUENODES, XPATHNODES, XPATHTEXT
Constructor and Description |
---|
NodeFilter()
Creates a NodeFilter that accepts all Content-types.
|
NodeFilter(int contentType)
Creates a NodeFilter with the given bit-mask.
|
Modifier and Type | Method and Description |
---|---|
Filter |
and(Filter other)
Creates a Filter that is the logical AND of this and another Filter.
|
protected NodeFilter |
andNodeFilter(NodeFilter other)
Creates a Filter that is the logical AND of this and another
NodeFilter.
|
NodeFilter |
not()
Creates a Filter that is the logical NOT of this NodeFilter.
|
Filter |
or(Filter other)
Creates a Filter that is the logical OR of this and another Filter.
|
protected NodeFilter |
orNodeFilter(NodeFilter other)
Creates a Filter that is the logical OR of this and another
NodeFilter.
|
accept, getMask
andIndexFilter, toString
public NodeFilter()
public NodeFilter(int contentType)
Filter f = new NodeFilter(Content.ELEMENT | Content.TEXT);
contentType
- a bit-mask representing one or more content types.public NodeFilter not()
public Filter and(Filter other)
public Filter or(Filter other)
protected NodeFilter andNodeFilter(NodeFilter other)
andNodeFilter
in class Filter
other
- the other NodeFilter.protected NodeFilter orNodeFilter(NodeFilter other)
orNodeFilter
in class Filter
other
- the other NodeFilter.