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.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.Set
checkedExps
set of checked Expressions.private java.util.Map
checkedRefExps
set of checked ReferenceExps.private static int
HAS_ANYSTRING
private static int
HAS_DATA
private static int
HAS_ELEMENT
private static java.lang.Integer[]
intPool
integer pool implementation.private TREXBaseReader
reader
private boolean
rejectTextInInterleave
If 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 boolean
isError(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.Object
merge(java.lang.Object o1, java.lang.Object o2)
java.lang.Object
onAnyString()
java.lang.Object
onAttribute(AttributeExp exp)
java.lang.Object
onChoice(ChoiceExp exp)
java.lang.Object
onConcur(ConcurExp exp)
java.lang.Object
onData(DataExp exp)
java.lang.Object
onElement(ElementExp exp)
java.lang.Object
onEpsilon()
java.lang.Object
onInterleave(InterleaveExp exp)
java.lang.Object
onList(ListExp exp)
java.lang.Object
onMixed(MixedExp exp)
java.lang.Object
onNullSet()
java.lang.Object
onOneOrMore(OneOrMoreExp exp)
java.lang.Object
onOther(OtherExp exp)
java.lang.Object
onRef(ReferenceExp exp)
java.lang.Object
onSequence(SequenceExp exp)
java.lang.Object
onValue(ValueExp exp)
private static int
toInt(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:
onRef
in interfaceExpressionVisitor
-
onOther
public java.lang.Object onOther(OtherExp exp)
- Specified by:
onOther
in interfaceExpressionVisitor
-
onInterleave
public java.lang.Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleave
in interfaceExpressionVisitor
-
onSequence
public java.lang.Object onSequence(SequenceExp exp)
- Specified by:
onSequence
in interfaceExpressionVisitor
-
onEpsilon
public java.lang.Object onEpsilon()
- Specified by:
onEpsilon
in interfaceExpressionVisitor
-
onNullSet
public java.lang.Object onNullSet()
- Specified by:
onNullSet
in interfaceExpressionVisitor
-
onData
public java.lang.Object onData(DataExp exp)
- Specified by:
onData
in interfaceExpressionVisitor
-
onValue
public java.lang.Object onValue(ValueExp exp)
- Specified by:
onValue
in interfaceExpressionVisitor
-
onList
public java.lang.Object onList(ListExp exp)
- Specified by:
onList
in interfaceExpressionVisitor
-
onAnyString
public java.lang.Object onAnyString()
- Specified by:
onAnyString
in interfaceExpressionVisitor
-
onAttribute
public java.lang.Object onAttribute(AttributeExp exp)
- Specified by:
onAttribute
in interfaceExpressionVisitor
-
onElement
public java.lang.Object onElement(ElementExp exp)
- Specified by:
onElement
in 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:
onChoice
in interfaceExpressionVisitor
-
onConcur
public java.lang.Object onConcur(ConcurExp exp)
- Specified by:
onConcur
in interfaceExpressionVisitor
-
onOneOrMore
public java.lang.Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMore
in interfaceExpressionVisitor
-
onMixed
public java.lang.Object onMixed(MixedExp exp)
- Specified by:
onMixed
in interfaceExpressionVisitor
-
-