public class NameSetFilter extends MaskFilter
|
'.
The set may also be provided as a list of name tokens. NameSetFilter
compares interned symbols by identity, for efficiency, and can either
compare short names or long identifiers.
NameFilter has an accept(Content)
method, which returns true,
if the Content node is an acceptable named entity, and the node's name is
in the set. Tested nodes are compared either using their short name, or
their long identifier, depending on whether the reference names are short
names or long identifiers (containing a colon ':
's separator.
If at least one reference name contains a colon, all comparisons will be
done using getIdentifier()
, otherwise comparisons will be
done using getName()
.
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Boolean> |
nameSet
The interned set of reference names.
|
private boolean |
simple
A flag indicating whether the reference names are simple names (true),
or full identifiers (false) prefixed with a namespace identifier and
colon.
|
mask
ALLCONTENT, NAMENODES, PARENTNODES, PROPERTYNODES, VALUENODES, XPATHNODES, XPATHTEXT
Modifier | Constructor and Description |
---|---|
|
NameSetFilter(java.util.List<java.lang.String> nameList)
Creates a NameSetFilter selecting named nodes from a list of names.
|
|
NameSetFilter(java.util.List<java.lang.String> nameList,
int contentType)
Creates a NameSetFilter selecting named nodes of a given content-type
from a list of names.
|
private |
NameSetFilter(NameSetFilter filter,
int contentType)
Secret constructor to copy a NameSetFilter but reset the type mask.
|
|
NameSetFilter(java.lang.String nameRange)
Creates a NameSetFilter selecting named nodes from an enumerated
range.
|
|
NameSetFilter(java.lang.String nameRange,
int contentType)
Creates a NameSetFilter selecting named nodes of a given content-type
from an enumerated range.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Content node)
Reports whether a given Content node is accepted by this NameSetFilter.
|
protected NameSetFilter |
andNodeFilter(NodeFilter other)
Creates a Filter that is the conjunction of this NameSetFilter and a
NodeFilter.
|
private boolean |
matchName(Markup node)
Reports whether a Markup node's name is contained within the name set.
|
private void |
populate(java.util.List<java.lang.String> nameList)
Populates the name set from a list of names.
|
private void |
populate(java.lang.String nameRange)
Populate the name set from an enumerated range of names.
|
getMask
and, andIndexFilter, not, or, orNodeFilter, toString
private java.util.Map<java.lang.String,java.lang.Boolean> nameSet
private boolean simple
getName()
or getIdentifier()
.public NameSetFilter(java.lang.String nameRange)
nameRange
- an enumerated range of names.public NameSetFilter(java.lang.String nameRange, int contentType)
nameRange
- an enumerated range of names.contentType
- a bit-mask representing one or more content-types.private NameSetFilter(NameSetFilter filter, int contentType)
filter
- the copied NameSetFilter.contentType
- a bit-mask specifying one or more content types.public NameSetFilter(java.util.List<java.lang.String> nameList)
nameList
- a list of reference names.public NameSetFilter(java.util.List<java.lang.String> nameList, int contentType)
nameList
- a list of reference names.contentType
- a bit-mask representing one or more content-types.private void populate(java.lang.String nameRange)
|
', or a
space, then trims leading and trailing space, then adds the interned
symbols to an identity-set.nameRange
- an enumerated range of names to match.private void populate(java.util.List<java.lang.String> nameList)
nameList
- a list of names to match.private boolean matchName(Markup node)
node
- the named node to match.public boolean accept(Content node)
accept
in class MaskFilter
node
- a Content node.protected NameSetFilter andNodeFilter(NodeFilter other)
andNodeFilter
in class Filter
other
- the other NodeFilter.