Class ExpressionWithChildState

All Implemented Interfaces:
ExpressionOwner, ContentHandler
Direct Known Subclasses:
AttributeState, ChoiceState, ComplexContentState, ConcurState, ElementDeclState, InterleaveState, MixedState, RedefinableDeclState, SequenceState, SimpleContentState

public abstract class ExpressionWithChildState extends ExpressionState implements ExpressionOwner
State that parses Expression which contains other expressions.
Author:
Kohsuke KAWAGUCHI
  • Field Details

    • exp

      protected Expression exp
      expression object that is being created. See #castPattern and #annealPattern methods for how will a pattern be created.
  • Constructor Details

    • ExpressionWithChildState

      public ExpressionWithChildState()
  • Method Details

    • startSelf

      protected void startSelf()
      Description copied from class: State
      performs a task that should be done before reading any child elements. derived-class can safely read startTag and/or parentState values.
      Overrides:
      startSelf in class State
    • initialExpression

      protected Expression initialExpression()
      sets initial pattern
    • defaultExpression

      protected Expression defaultExpression()
      computes default expression. this method is called before annealExpression when no child expression is given during parsing. return null to signal an error.
    • onEndChild

      public final void onEndChild(Expression childExpression)
      receives a Pattern object that is contained in this element.
      Specified by:
      onEndChild in interface ExpressionOwner
    • makeExpression

      protected final Expression makeExpression()
      Description copied from class: ExpressionState
      This method is called from endElement method. Implementation has to provide Expression object that represents the content of this element.
      Specified by:
      makeExpression in class ExpressionState
    • createChildState

      protected State createChildState(StartTagInfo tag)
      Description copied from class: SimpleState
      creates appropriate child state object for this element
      Specified by:
      createChildState in class SimpleState
    • castExpression

      protected abstract Expression castExpression(Expression halfCastedExpression, Expression newChildExpression)
      combines half-made expression and newly found child expression into the expression.

      Say this container has three child expression exp1,exp2, and exp3. Then, the expression of this state will be made by the following method invocations.

         annealExpression(
           castExpression(
             castExpression(
               castExpression(null,exp1), exp2), exp3 ) )
       
    • annealExpression

      protected Expression annealExpression(Expression exp)
      performs final wrap-up and returns a fully created Expression object that represents this element.