Creates a new Expression by combining existing expressions.
all expressions are memorized and unified so that every subexpression
will be shared and reused. Optimization will be also done transparently.
For example, createChoice(P,P) will result in P. createSequence(P,nullSet)
will result in nullSet.
Furthermore, associative operators are grouped to the left.
createChoice( (P|Q), (R|S) ) will be ((P|Q)|R)|S.
Although this unification is essential, this is also the performance
bottle neck. In particular, createChoice and createSequence are two most
commonly called methods.
For example, when validating a DocBook XML (150KB) twice against
DocBook.trex(237KB), createChoice is called 63000 times and createSequence
called 23000 times. (the third is the createOptional method and only 1560 times.)
And they took more than 10% of validation time, which is the worst
time-consuming method.
Therefore, please beware that this class includes several ugly code optimization.
createAnyString
public final Expression createAnyString()
createData
public final Expression createData(XSDatatype dt)
createEpsilon
public final Expression createEpsilon()
createNullSet
public final Expression createNullSet()
createValue
public final Expression createValue(XSDatatype dt,
Object value)