Package com.sun.msv.reader.trex
Class TREXSequencedStringChecker
- java.lang.Object
-
- com.sun.msv.reader.trex.TREXSequencedStringChecker
-
- All Implemented Interfaces:
ExpressionVisitor
public class TREXSequencedStringChecker extends java.lang.Object implements ExpressionVisitor
makes sure that there is no sequenced string. "sequenced string" is something like this. Also, TREX prohibits sequence of typed strings and elements.abc In this checker, we introduce a function "f" that takes a string and computes the string-sensitivity of the pattern.
"f" returns 3 bits of information. One is whether it contains elements. Another is whehter it contains text. And the last is whether it contains DataExp/ValueExp.
"f" is computed recursively through the pattern.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.SetcheckedExpsset of checked Expressions.private java.util.MapcheckedRefExpsset of checked ReferenceExps.private static intHAS_ANYSTRINGprivate static intHAS_DATAprivate static intHAS_ELEMENTprivate static java.lang.Integer[]intPoolinteger pool implementation.private TREXBaseReaderreaderprivate booleanrejectTextInInterleaveIf this flag is set to true, this class raises an error for anyStrings in two branches of interleave.
-
Constructor Summary
Constructors Constructor Description TREXSequencedStringChecker(TREXBaseReader reader, boolean _rejectTextInInterleave)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleanisError(java.lang.Object o1, java.lang.Object o2)It is an error if a pattern with data is combined to other patterns.private static java.lang.Objectmerge(java.lang.Object o1, java.lang.Object o2)java.lang.ObjectonAnyString()java.lang.ObjectonAttribute(AttributeExp exp)java.lang.ObjectonChoice(ChoiceExp exp)java.lang.ObjectonConcur(ConcurExp exp)java.lang.ObjectonData(DataExp exp)java.lang.ObjectonElement(ElementExp exp)java.lang.ObjectonEpsilon()java.lang.ObjectonInterleave(InterleaveExp exp)java.lang.ObjectonList(ListExp exp)java.lang.ObjectonMixed(MixedExp exp)java.lang.ObjectonNullSet()java.lang.ObjectonOneOrMore(OneOrMoreExp exp)java.lang.ObjectonOther(OtherExp exp)java.lang.ObjectonRef(ReferenceExp exp)java.lang.ObjectonSequence(SequenceExp exp)java.lang.ObjectonValue(ValueExp exp)private static inttoInt(java.lang.Object o)
-
-
-
Field Detail
-
rejectTextInInterleave
private final boolean rejectTextInInterleave
If this flag is set to true, this class raises an error for anyStrings in two branches of interleave.
-
intPool
private static final java.lang.Integer[] intPool
integer pool implementation.
-
HAS_ELEMENT
private static final int HAS_ELEMENT
- See Also:
- Constant Field Values
-
HAS_ANYSTRING
private static final int HAS_ANYSTRING
- See Also:
- Constant Field Values
-
HAS_DATA
private static final int HAS_DATA
- See Also:
- Constant Field Values
-
reader
private final TREXBaseReader reader
-
checkedExps
private final java.util.Set checkedExps
set of checked Expressions. once an ElementExp/AttributeExp is checked, it will be added to this set. this set is used to prevent infinite recursion.
-
checkedRefExps
private final java.util.Map checkedRefExps
set of checked ReferenceExps. Once a ReferenceExp is checked, it will be added (with its result) to this map. This is useful to speed up the check.
-
-
Constructor Detail
-
TREXSequencedStringChecker
public TREXSequencedStringChecker(TREXBaseReader reader, boolean _rejectTextInInterleave)
-
-
Method Detail
-
onRef
public java.lang.Object onRef(ReferenceExp exp)
- Specified by:
onRefin interfaceExpressionVisitor
-
onOther
public java.lang.Object onOther(OtherExp exp)
- Specified by:
onOtherin interfaceExpressionVisitor
-
onInterleave
public java.lang.Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleavein interfaceExpressionVisitor
-
onSequence
public java.lang.Object onSequence(SequenceExp exp)
- Specified by:
onSequencein interfaceExpressionVisitor
-
onEpsilon
public java.lang.Object onEpsilon()
- Specified by:
onEpsilonin interfaceExpressionVisitor
-
onNullSet
public java.lang.Object onNullSet()
- Specified by:
onNullSetin interfaceExpressionVisitor
-
onData
public java.lang.Object onData(DataExp exp)
- Specified by:
onDatain interfaceExpressionVisitor
-
onValue
public java.lang.Object onValue(ValueExp exp)
- Specified by:
onValuein interfaceExpressionVisitor
-
onList
public java.lang.Object onList(ListExp exp)
- Specified by:
onListin interfaceExpressionVisitor
-
onAnyString
public java.lang.Object onAnyString()
- Specified by:
onAnyStringin interfaceExpressionVisitor
-
onAttribute
public java.lang.Object onAttribute(AttributeExp exp)
- Specified by:
onAttributein interfaceExpressionVisitor
-
onElement
public java.lang.Object onElement(ElementExp exp)
- Specified by:
onElementin interfaceExpressionVisitor
-
toInt
private static final int toInt(java.lang.Object o)
-
merge
private static java.lang.Object merge(java.lang.Object o1, java.lang.Object o2)
-
isError
private static boolean isError(java.lang.Object o1, java.lang.Object o2)It is an error if a pattern with data is combined to other patterns.
-
onChoice
public java.lang.Object onChoice(ChoiceExp exp)
- Specified by:
onChoicein interfaceExpressionVisitor
-
onConcur
public java.lang.Object onConcur(ConcurExp exp)
- Specified by:
onConcurin interfaceExpressionVisitor
-
onOneOrMore
public java.lang.Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMorein interfaceExpressionVisitor
-
onMixed
public java.lang.Object onMixed(MixedExp exp)
- Specified by:
onMixedin interfaceExpressionVisitor
-
-