public class LaxDefaultNameClass extends NameClass
In "lax" mode, we need a name class that matches all undefined names. Although it is possible to use DifferenceNameClass for this purpose, it is not a cost-efficient way because typically it becomes very large. (If there are twenty element declarations, we'll need twenty DifferenceNameClass to exclude all defined names).
This name class uses a Set
to hold multiple names. If a name
is contained in that set, it'll be rejected. If a name is not contained,
it'll be accepted.
Special care is taken to make this NC as seamless as possible. When the visit method is called, the equivalent name class is constructed internally and the visitor will visit that name class. In this way, the visitors won't notice the existance of this "special" name class.
Modifier and Type | Field and Description |
---|---|
private NameClass |
base |
protected NameClass |
equivalentNameClass
equivalent name class by conventional primitives.
|
private java.util.Set |
names
set of
StringPair s. |
private static long |
serialVersionUID |
ALL, LOCALNAME_WILDCARD, NAMESPACE_WILDCARD, NONE
Constructor and Description |
---|
LaxDefaultNameClass(NameClass _base) |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(java.lang.String namespaceURI,
java.lang.String localName)
checks if this name class accepts given namespace:localName pair.
|
void |
addName(java.lang.String namespaceURI,
java.lang.String localName)
add a name so that this name will be rejected by the accepts method.
|
java.lang.Object |
visit(NameClassVisitor visitor)
visitor pattern support
|
private NameClass base
protected NameClass equivalentNameClass
private final java.util.Set names
StringPair
s.
each item represents one name.
it also contains WILDCARD as entry.private static final long serialVersionUID
public LaxDefaultNameClass(NameClass _base)
_base
- this name class accepts a name if
public java.lang.Object visit(NameClassVisitor visitor)
NameClass
public boolean accepts(java.lang.String namespaceURI, java.lang.String localName)
NameClass
accepts
in class NameClass
namespaceURI
- namespace URI to be tested. If this value equals to
NAMESPACE_WILDCARD, implementation must assume that
valid namespace is specified. this twist will be used for
error diagnosis.localName
- local part to be tested. As with namespaceURI, LOCALNAME_WILDCARD
will acts as a wild card.public void addName(java.lang.String namespaceURI, java.lang.String localName)