com.sun.msv.verifier.regexp
Class AttributePicker

java.lang.Object
  |
  +--com.sun.msv.verifier.regexp.AttributePicker
All Implemented Interfaces:
ExpressionVisitorExpression

public class AttributePicker
extends Object
implements ExpressionVisitorExpression

removes all unnecessary expressions and creates an expression that consists of required attributes and choices only.

For example, <choice> <element /> <attribute /> </choice> will be converted to <empty /> because no attribute is required. But <choice> <attribute /> <attribute /> </choice> will remain the same because one or the other is required. this method also removes SequenceExp. <sequence> <attribute name="A" /> <attribute name="B" /> </sequence> will be converted to <attribute name="A" /> This function object is used only for error recovery. Resulting expressions always consist only of <choice>s and <attribute>s.

Author:
Kohsuke KAWAGUCHI

Constructor Summary
AttributePicker(ExpressionPool pool)
           
 
Method Summary
 Expression onAnyString()
           
 Expression onAttribute(AttributeExp exp)
           
 Expression onChoice(ChoiceExp exp)
           
 Expression onConcur(ConcurExp exp)
           
 Expression onElement(ElementExp exp)
           
 Expression onEpsilon()
           
 Expression onInterleave(InterleaveExp exp)
           
 Expression onKey(KeyExp exp)
           
 Expression onList(ListExp exp)
           
 Expression onMixed(MixedExp exp)
           
 Expression onNullSet()
           
 Expression onOneOrMore(OneOrMoreExp exp)
           
 Expression onOther(OtherExp exp)
           
 Expression onRef(ReferenceExp exp)
           
 Expression onSequence(SequenceExp exp)
           
 Expression onTypedString(TypedStringExp exp)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributePicker

public AttributePicker(ExpressionPool pool)
Method Detail

onElement

public Expression onElement(ElementExp exp)
Specified by:
onElement in interface ExpressionVisitorExpression

onMixed

public Expression onMixed(MixedExp exp)
Specified by:
onMixed in interface ExpressionVisitorExpression

onAnyString

public Expression onAnyString()
Specified by:
onAnyString in interface ExpressionVisitorExpression

onEpsilon

public Expression onEpsilon()
Specified by:
onEpsilon in interface ExpressionVisitorExpression

onNullSet

public Expression onNullSet()
Specified by:
onNullSet in interface ExpressionVisitorExpression

onRef

public Expression onRef(ReferenceExp exp)
Specified by:
onRef in interface ExpressionVisitorExpression

onOther

public Expression onOther(OtherExp exp)
Specified by:
onOther in interface ExpressionVisitorExpression

onTypedString

public Expression onTypedString(TypedStringExp exp)
Specified by:
onTypedString in interface ExpressionVisitorExpression

onList

public Expression onList(ListExp exp)
Specified by:
onList in interface ExpressionVisitorExpression

onKey

public Expression onKey(KeyExp exp)
Specified by:
onKey in interface ExpressionVisitorExpression

onAttribute

public Expression onAttribute(AttributeExp exp)
Specified by:
onAttribute in interface ExpressionVisitorExpression

onOneOrMore

public Expression onOneOrMore(OneOrMoreExp exp)
Specified by:
onOneOrMore in interface ExpressionVisitorExpression

onSequence

public Expression onSequence(SequenceExp exp)
Specified by:
onSequence in interface ExpressionVisitorExpression

onInterleave

public Expression onInterleave(InterleaveExp exp)
Specified by:
onInterleave in interface ExpressionVisitorExpression

onConcur

public Expression onConcur(ConcurExp exp)
Specified by:
onConcur in interface ExpressionVisitorExpression

onChoice

public Expression onChoice(ChoiceExp exp)
Specified by:
onChoice in interface ExpressionVisitorExpression