Top Description Inners Fields Constructors Methods
com.sun.msv.verifier.regexp

public Class CombinedChildContentExpCreator

extends Object
implements ExpressionVisitorVoid
Class Inheritance
All Implemented Interfaces
com.sun.msv.grammar.ExpressionVisitorVoid
Imports
com.sun.msv.grammar.AttributeExp, .ChoiceExp, .ConcurExp, .DataExp, .ElementExp, .Expression, .ExpressionPool, .ExpressionVisitorVoid, .InterleaveExp, .ListExp, .MixedExp, .OneOrMoreExp, .OtherExp, .ReferenceExp, .SequenceExp, .ValueExp, com.sun.msv.util.StartTagInfo, .StringPair

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

    <!-- javadoc escape -->
  <choice>
    <concur>
      <element> ..(A).. </element>
      <group>
        <element> ..(B).. </element>
        ...
      </group>
    </concur>
    <group>
      <element> ..(C).. </element>
      ....
    </group>
  </choice>
then the combined child expression is
  <choice>
    <concur>
      ..(A').. 
      ..(B').. 
    </concur>
    ..(C').. 
  </choice>
and elements of concern and its attribute-pruned content models are <element> ..(A).. </element> -> ..(A').. <element> ..(B).. </element> -> ..(B').. <element> ..(C).. </element> -> ..(C').. (A'),(B'), and (C') are attribute-pruned content models of (A),(B), and (C) respectively. Note that combined child pattern contains only <choice> and <concur> as its grue (of course, except ..(A').. , ..(B').. , and ..(C').. ). This function object also calculates "continuation", which is the residual expression after eating elements of concern. For example, say the expression is "(A|(B,C))?,D". When EoC is B, then the continuation will be C,D. When EoC is A, then the continuation will be D. When EoC is D, then the continuation will be epsilon. When there are multiple EoC, (say A and B), then the continuation will be meaningless (because it depends on which EoC will be accepted), and thus won't be used. However, the implementator must be aware that it is possible for a binary operator to have EoC on both branch and EoC is still unique. The following expression is an example. (A|B)*,C?,(A|B)* when A is EoC, SequenceExp of (A|B)* and C?,(A|B)* has EoC on both branch.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private boolean
private Expression
private Expression
private boolean
foundConcur

a flag that indicates that we have 'concur' element to combine elements of concern.

private int
protected final ExpressionPool
private ElementExp[]
result

matched elements.

private StartTagInfo

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final CombinedChildContentExpCreator.ExpressionPair
continueGet(Expression combinedPattern, StartTagInfo info, boolean checkTagName)

public CombinedChildContentExpCreator.ExpressionPair
get(Expression
if this flag is false, Attribute feeding & pruning are skipped and AttributeExps are fully remained in the resulting expression.
combinedPattern
,
StartTagInfo info, boolean
if this flag is false, tag name check is skipped.
checkTagName
)

computes a combined child content pattern and its continuation, with error recovery.

public CombinedChildContentExpCreator.ExpressionPair
get(Expression combinedPattern, StartTagInfo info)

computes a combined child content pattern and (,if possible,) its continuation.

public final ElementExp[]
getMatchedElements()

obtains matched elements.

public final boolean

Returns:

true if the combined child content expression is not the union of all elements of concern. false if otherwise.
isComplex
()

checks if the result of 'get' method is not the union of all elements of concern.

public final int
numMatchedElements()

gets the number of matched elements.

public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkTagNameback to summary
private boolean checkTagName
contentback to summary
private Expression content
continuationback to summary
private Expression continuation
foundConcurback to summary
private boolean foundConcur

a flag that indicates that we have 'concur' element to combine elements of concern. If 'concur' is used, we have to keep track of combined child content expression to detect errors. If 'concur' is not used, then keeping track of all primitive child content expressions are enough to detect errors.

numElementsback to summary
private int numElements
poolback to summary
protected final ExpressionPool pool
resultback to summary
private ElementExp[] result

matched elements. the buffer is usually bigger than numElements, but only first numElements items are valid result.

tagInfoback to summary
private StartTagInfo tagInfo

Constructor Detail

CombinedChildContentExpCreatorback to summary
protected CombinedChildContentExpCreator(ExpressionPool pool)

Method Detail

continueGetback to summary
public final CombinedChildContentExpCreator.ExpressionPair continueGet(Expression combinedPattern, StartTagInfo info, boolean checkTagName)
getback to summary
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
combinedPattern:Expression

if this flag is false, Attribute feeding & pruning are skipped and AttributeExps are fully remained in the resulting expression.

checkTagName:boolean

if this flag is false, tag name check is skipped.

getback to summary
public CombinedChildContentExpCreator.ExpressionPair get(Expression combinedPattern, StartTagInfo info)

computes a combined child content pattern and (,if possible,) its continuation.

getMatchedElementsback to summary
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.

isComplexback to summary
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:boolean

true if the combined child content expression is not the union of all elements of concern. false if otherwise.

numMatchedElementsback to summary
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.

onAnyStringback to summary
public void onAnyString()

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onAnyString.

onAttributeback to summary
public void onAttribute(AttributeExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onAttribute.

onChoiceback to summary
public void onChoice(ChoiceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onChoice.

onConcurback to summary
public void onConcur(ConcurExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onConcur.

onDataback to summary
public void onData(DataExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onData.

onElementback to summary
public void onElement(ElementExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onElement.

onEpsilonback to summary
public void onEpsilon()

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onEpsilon.

onInterleaveback to summary
public void onInterleave(InterleaveExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onInterleave.

onListback to summary
public void onList(ListExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onList.

onMixedback to summary
public void onMixed(MixedExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onMixed.

onNullSetback to summary
public void onNullSet()

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onNullSet.

onOneOrMoreback to summary
public void onOneOrMore(OneOrMoreExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onOneOrMore.

onOtherback to summary
public void onOther(OtherExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onOther.

onRefback to summary
public void onRef(ReferenceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onRef.

onSequenceback to summary
public void onSequence(SequenceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onSequence.

onValueback to summary
public void onValue(ValueExp exp)

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onValue.

com.sun.msv.verifier.regexp back to summary

public Class CombinedChildContentExpCreator.ExpressionPair

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.msv.verifier.regexp.CombinedChildContentExpCreator.ExpressionPair

Field Summary

Modifier and TypeField and Description
public final Expression
public final Expression

Constructor Summary

AccessConstructor and Description
public
ExpressionPair(Expression content, Expression continuation)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentback to summary
public final Expression content
continuationback to summary
public final Expression continuation

Constructor Detail

ExpressionPairback to summary
public ExpressionPair(Expression content, Expression continuation)