Top Description Fields Constructors Methods
com.sun.msv.reader.trex

public Class TREXSequencedStringChecker

extends Object
implements ExpressionVisitor
Class Inheritance
All Implemented Interfaces
com.sun.msv.grammar.ExpressionVisitor
Imports
java.util.Map, .Set, com.sun.msv.grammar.AttributeExp, .ChoiceExp, .ConcurExp, .DataExp, .ElementExp, .Expression, .ExpressionVisitor, .InterleaveExp, .ListExp, .MixedExp, .OneOrMoreExp, .OtherExp, .ReferenceExp, .SequenceExp, .ValueExp

makes sure that there is no sequenced string. "sequenced string" is something like this. <oneOrMore> <string> abc </string> </oneOrMore> Also, TREX prohibits sequence of typed strings and elements.

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.

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private final Set<Expression>
checkedExps

set of checked Expressions.

private final Map<ReferenceExp, Object>
checkedRefExps

set of checked ReferenceExps.

private static final int
private static final int
private static final int
private static final Integer[]
intPool

integer pool implementation.

private final TREXBaseReader
private final boolean
rejectTextInInterleave

If this flag is set to true, this class raises an error for anyStrings in two branches of interleave.

Constructor Summary

AccessConstructor and Description
public
TREXSequencedStringChecker(TREXBaseReader reader, boolean _rejectTextInInterleave)

Method Summary

Modifier and TypeMethod and Description
private static boolean
isError(Object o1, Object o2)

It is an error if a pattern with data is combined to other patterns.

private static Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
private static final int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkedExpsback to summary
private final Set<Expression> 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.

checkedRefExpsback to summary
private final Map<ReferenceExp, Object> 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.

HAS_ANYSTRINGback to summary
private static final int HAS_ANYSTRING
HAS_DATAback to summary
private static final int HAS_DATA
HAS_ELEMENTback to summary
private static final int HAS_ELEMENT
intPoolback to summary
private static final Integer[] intPool

integer pool implementation.

readerback to summary
private final TREXBaseReader reader
rejectTextInInterleaveback to summary
private final boolean rejectTextInInterleave

If this flag is set to true, this class raises an error for anyStrings in two branches of interleave.

Constructor Detail

TREXSequencedStringCheckerback to summary
public TREXSequencedStringChecker(TREXBaseReader reader, boolean _rejectTextInInterleave)

Method Detail

isErrorback to summary
private static boolean isError(Object o1, Object o2)

It is an error if a pattern with data is combined to other patterns.

mergeback to summary
private static Object merge(Object o1, Object o2)
onAnyStringback to summary
public Object onAnyString()

Implements com.sun.msv.grammar.ExpressionVisitor.onAnyString.

onAttributeback to summary
public Object onAttribute(AttributeExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onAttribute.

onChoiceback to summary
public Object onChoice(ChoiceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onChoice.

onConcurback to summary
public Object onConcur(ConcurExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onConcur.

onDataback to summary
public Object onData(DataExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onData.

onElementback to summary
public Object onElement(ElementExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onElement.

onEpsilonback to summary
public Object onEpsilon()

Implements com.sun.msv.grammar.ExpressionVisitor.onEpsilon.

onInterleaveback to summary
public Object onInterleave(InterleaveExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onInterleave.

onListback to summary
public Object onList(ListExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onList.

onMixedback to summary
public Object onMixed(MixedExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onMixed.

onNullSetback to summary
public Object onNullSet()

Implements com.sun.msv.grammar.ExpressionVisitor.onNullSet.

onOneOrMoreback to summary
public Object onOneOrMore(OneOrMoreExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onOneOrMore.

onOtherback to summary
public Object onOther(OtherExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onOther.

onRefback to summary
public Object onRef(ReferenceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onRef.

onSequenceback to summary
public Object onSequence(SequenceExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onSequence.

onValueback to summary
public Object onValue(ValueExp exp)

Implements com.sun.msv.grammar.ExpressionVisitor.onValue.

toIntback to summary
private static final int toInt(Object o)