com.sun.msv.grammar

Class NameClass

public abstract class NameClass extends Object implements Serializable

validator of (namespaceURI,localPart) pair. This is equivalent to RELAX NG's "name class".

Author: Kohsuke KAWAGUCHI

Field Summary
static NameClassALL
name class that accepts everything.
static StringLOCALNAME_WILDCARD
static StringNAMESPACE_WILDCARD
wildcard should be accepted by any name class.
static NameClassNONE
Name class that accepts nothing.
Method Summary
abstract booleanaccepts(String namespaceURI, String localName)
checks if this name class accepts given namespace:localName pair.
booleanaccepts(StringPair name)
booleanincludes(NameClass rhs)
Returns true if this name class is a superset of another name class.
static NameClassintersection(NameClass lhs, NameClass rhs)
Computes the intersection of two name classes.
booleanisEqualTo(NameClass rhs)
Returns true if this name class represents the same set as the given name class.
booleanisNull()
Returns true if this name class doesn't accept anything.
NameClasssimplify()
Computes the equivalent but simple name class.
static NameClassunion(NameClass lhs, NameClass rhs)
Computes the union of two name classes.
abstract Objectvisit(NameClassVisitor visitor)
visitor pattern support

Field Detail

ALL

public static final NameClass ALL
name class that accepts everything.

LOCALNAME_WILDCARD

public static final String LOCALNAME_WILDCARD

NAMESPACE_WILDCARD

public static final String NAMESPACE_WILDCARD
wildcard should be accepted by any name class.

NONE

public static final NameClass NONE
Name class that accepts nothing.

Method Detail

accepts

public abstract boolean accepts(String namespaceURI, String localName)
checks if this name class accepts given namespace:localName pair.

Parameters: 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.

Returns: true if the pair is accepted, false otherwise.

accepts

public final boolean accepts(StringPair name)

includes

public final boolean includes(NameClass rhs)
Returns true if this name class is a superset of another name class.

intersection

public static NameClass intersection(NameClass lhs, NameClass rhs)
Computes the intersection of two name classes.

isEqualTo

public final boolean isEqualTo(NameClass rhs)
Returns true if this name class represents the same set as the given name class.

isNull

public boolean isNull()
Returns true if this name class doesn't accept anything.

simplify

public NameClass simplify()
Computes the equivalent but simple name class.

union

public static NameClass union(NameClass lhs, NameClass rhs)
Computes the union of two name classes.

visit

public abstract Object visit(NameClassVisitor visitor)
visitor pattern support