Package com.sun.msv.verifier.regexp
Class CombinedChildContentExpCreator
- java.lang.Object
-
- com.sun.msv.verifier.regexp.CombinedChildContentExpCreator
-
- All Implemented Interfaces:
ExpressionVisitorVoid
public class CombinedChildContentExpCreator extends Object implements ExpressionVisitorVoid
creates "combined child content expression" and gathers "elements of concern" and its "attribute-pruned" content model. Intuitively, "combined child content expression" is a set of content models of "elements of concern", which is appropriately combined to express dependency between elements. "Elements of concern" are ElementExps that are possibly applicable to the next element. These gathered element declarations are then tested against next XML element. "Attribute-pruned" content model is a content model after consuming AttributeTokens and removing unused AttributeExp nodes.For example, when the current expression is
then the combined child expression is..(A).. ..(B).. .....(C).. ....
and elements of concern and its attribute-pruned content models are..(A').. ..(B').. ..(C')....(A).. -> ..(A')....(B).. -> ..(B')....(C).. -> ..(C')..- Author:
- Kohsuke KAWAGUCHI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CombinedChildContentExpCreator.ExpressionPair
-
Field Summary
Fields Modifier and Type Field Description protected ExpressionPool
pool
-
Constructor Summary
Constructors Modifier Constructor Description protected
CombinedChildContentExpCreator(ExpressionPool pool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CombinedChildContentExpCreator.ExpressionPair
continueGet(Expression combinedPattern, StartTagInfo info, boolean checkTagName)
CombinedChildContentExpCreator.ExpressionPair
get(Expression combinedPattern, StartTagInfo info)
computes a combined child content pattern and (,if possible,) its continuation.CombinedChildContentExpCreator.ExpressionPair
get(Expression combinedPattern, StartTagInfo info, boolean checkTagName)
computes a combined child content pattern and its continuation, with error recovery.ElementExp[]
getMatchedElements()
obtains matched elements.boolean
isComplex()
checks if the result of 'get' method is not the union of all elements of concern.int
numMatchedElements()
gets the number of matched elements.void
onAnyString()
void
onAttribute(AttributeExp exp)
void
onChoice(ChoiceExp exp)
void
onConcur(ConcurExp exp)
void
onData(DataExp exp)
void
onElement(ElementExp exp)
void
onEpsilon()
void
onInterleave(InterleaveExp exp)
void
onList(ListExp exp)
void
onMixed(MixedExp exp)
void
onNullSet()
void
onOneOrMore(OneOrMoreExp exp)
void
onOther(OtherExp exp)
void
onRef(ReferenceExp exp)
void
onSequence(SequenceExp exp)
void
onValue(ValueExp exp)
-
-
-
Field Detail
-
pool
protected final ExpressionPool pool
-
-
Constructor Detail
-
CombinedChildContentExpCreator
protected CombinedChildContentExpCreator(ExpressionPool pool)
-
-
Method Detail
-
get
public CombinedChildContentExpCreator.ExpressionPair get(Expression combinedPattern, StartTagInfo info, boolean checkTagName)
computes a combined child content pattern and its continuation, with error recovery. After calling this method, caller can call getElementsOfConcern to obtain each EoC. If both feedAttributes and checkTagName are false, then StartTagInfo is also unnecessary.- Parameters:
feedAttributes
- if this flag is false, Attribute feeding & pruning are skipped and AttributeExps are fully remained in the resulting expression.checkTagName
- if this flag is false, tag name check is skipped.
-
continueGet
public final CombinedChildContentExpCreator.ExpressionPair continueGet(Expression combinedPattern, StartTagInfo info, boolean checkTagName)
-
get
public CombinedChildContentExpCreator.ExpressionPair get(Expression combinedPattern, StartTagInfo info)
computes a combined child content pattern and (,if possible,) its continuation.
-
getMatchedElements
public final ElementExp[] getMatchedElements()
obtains matched elements. This method should be called after calling the get method. The result is in effect until the next invocation of get method.The extra care should be taken not to hold reference to the result longer than necessary. The contents of the result is valid only until the next invocation. Because OwnerAndContent objects are reused.
Apparently this is a bad design, but this design gives us better performance.
-
numMatchedElements
public final int numMatchedElements()
gets the number of matched elements. This method should be called after calling get method. The result is in effect until next invocation of get method. Apparently this is a bad design, but this design gives us better performance.
-
onConcur
public void onConcur(ConcurExp exp)
- Specified by:
onConcur
in interfaceExpressionVisitorVoid
-
onInterleave
public void onInterleave(InterleaveExp exp)
- Specified by:
onInterleave
in interfaceExpressionVisitorVoid
-
isComplex
public final boolean isComplex()
checks if the result of 'get' method is not the union of all elements of concern. Within this class, combined child content expression is always the union of all elements of concern. However, some derived class does not guarantee this property.- Returns:
- true if the combined child content expression is not the union of all elements of concern. false if otherwise.
-
onElement
public void onElement(ElementExp exp)
- Specified by:
onElement
in interfaceExpressionVisitorVoid
-
onOneOrMore
public void onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMore
in interfaceExpressionVisitorVoid
-
onMixed
public void onMixed(MixedExp exp)
- Specified by:
onMixed
in interfaceExpressionVisitorVoid
-
onAttribute
public void onAttribute(AttributeExp exp)
- Specified by:
onAttribute
in interfaceExpressionVisitorVoid
-
onEpsilon
public void onEpsilon()
- Specified by:
onEpsilon
in interfaceExpressionVisitorVoid
-
onNullSet
public void onNullSet()
- Specified by:
onNullSet
in interfaceExpressionVisitorVoid
-
onAnyString
public void onAnyString()
- Specified by:
onAnyString
in interfaceExpressionVisitorVoid
-
onData
public void onData(DataExp exp)
- Specified by:
onData
in interfaceExpressionVisitorVoid
-
onValue
public void onValue(ValueExp exp)
- Specified by:
onValue
in interfaceExpressionVisitorVoid
-
onList
public void onList(ListExp exp)
- Specified by:
onList
in interfaceExpressionVisitorVoid
-
onRef
public void onRef(ReferenceExp exp)
- Specified by:
onRef
in interfaceExpressionVisitorVoid
-
onOther
public void onOther(OtherExp exp)
- Specified by:
onOther
in interfaceExpressionVisitorVoid
-
onChoice
public void onChoice(ChoiceExp exp)
- Specified by:
onChoice
in interfaceExpressionVisitorVoid
-
onSequence
public void onSequence(SequenceExp exp)
- Specified by:
onSequence
in interfaceExpressionVisitorVoid
-
-