|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.msv.grammar.Expression
Primitive of the tree regular expression. most of the derived class is immutable (except ReferenceExp, ElementExp and OtherExp).
By making it immutable, it becomes possible to share subexpressions among expressions. This is very important for regular-expression-derivation based validation algorithm, as well as for smaller memory footprint. This sharing is automatically achieved by ExpressionPool.
ReferebceExp, ElementExp, and OtherExp are also placed in the pool, but these are not unified. Since they are not unified, application can derive classes from these expressions and mix them into AGM. This technique is heavily used to introduce schema language specific primitives into AGM. See various sub-packages of this package for examples.
The equals method must be implemented by the derived type. equals method will be used to unify the expressions. equals method can safely assume that its children are already unified (therefore == can be used to test the equality, rather than equals method).
To achieve unification, we overload the equals method so that
o1.equals(o2)
is true if o1 and o2 are identical.
There, those two objects must return the same hash code. For this purpose,
the hash code is calculated statically and cached internally.
Field Summary | |
static Expression |
anyString
special expression object that represents "any string". |
static Expression |
epsilon
Special expression object that represents epsilon (ε). |
static Expression |
nullSet
special expression object that represents the empty set (Φ). |
Object |
verifierTag
this field can be used by Verifier implementation to speed up validation. |
Method Summary | |
abstract boolean |
equals(Object o)
|
int |
hashCode()
|
boolean |
isEpsilonReducible()
returns true if this expression accepts empty sequence. |
abstract Object |
visit(ExpressionVisitor visitor)
|
abstract boolean |
visit(ExpressionVisitorBoolean visitor)
|
abstract Expression |
visit(ExpressionVisitorExpression visitor)
|
abstract void |
visit(ExpressionVisitorVoid visitor)
|
Object |
visit(RELAXExpressionVisitor visitor)
|
boolean |
visit(RELAXExpressionVisitorBoolean visitor)
|
Expression |
visit(RELAXExpressionVisitorExpression visitor)
|
void |
visit(RELAXExpressionVisitorVoid visitor)
|
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public transient Object verifierTag
public static final Expression epsilon
public static final Expression nullSet
public static final Expression anyString
This object is used as <anyString/> pattern of TREX and <text/> pattern of RELAX NG.
Method Detail |
public boolean isEpsilonReducible()
If this method is called while creating Expressions, then this method may return approximated value. When this method is used while validation, this method is guaranteed to return the correct value.
public abstract Object visit(ExpressionVisitor visitor)
public abstract Expression visit(ExpressionVisitorExpression visitor)
public abstract boolean visit(ExpressionVisitorBoolean visitor)
public abstract void visit(ExpressionVisitorVoid visitor)
public Object visit(RELAXExpressionVisitor visitor)
public Expression visit(RELAXExpressionVisitorExpression visitor)
public boolean visit(RELAXExpressionVisitorBoolean visitor)
public void visit(RELAXExpressionVisitorVoid visitor)
public final int hashCode()
hashCode
in class Object
public abstract boolean equals(Object o)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |