org.apache.crimson.parser
Class ContentModelState

java.lang.Object
  extended byorg.apache.crimson.parser.ContentModelState

class ContentModelState
extends Object

A content model state. This is basically an index into a content model node, emulating an automaton with primitives to consume tokens. It may create new content model states as a consequence of that consumption, or modify the current state. "Next" is used to track states that are pending completion after the "current automaton" completes its task.

Author:
David Brownell, Arthur van Hoff
See Also:
ContentModel, ValidatingParser

Field Summary
private  ContentModel model
           
private  ContentModelState next
           
private  boolean sawOne
           
 
Constructor Summary
(package private) ContentModelState(ContentModel model)
          Create a content model state for a content model.
private ContentModelState(Object content, ContentModelState next)
          Create a content model state for a content model, stacking a state for subsequent processing.
 
Method Summary
(package private)  ContentModelState advance(String token)
          Advance this state to a new state, or throw an exception (use a more appropriate one?)
(package private)  boolean terminate()
          Check if the state can be terminated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

private ContentModel model

sawOne

private boolean sawOne

next

private ContentModelState next
Constructor Detail

ContentModelState

ContentModelState(ContentModel model)
Create a content model state for a content model. When the state advances to null, this automaton has finished.


ContentModelState

private ContentModelState(Object content,
                          ContentModelState next)
Create a content model state for a content model, stacking a state for subsequent processing.

Method Detail

terminate

boolean terminate()
Check if the state can be terminated. That is, there are no more tokens required in the input stream.

Returns:
true if the model can terminate without further input

advance

ContentModelState advance(String token)
                    throws EndOfInputException
Advance this state to a new state, or throw an exception (use a more appropriate one?) if the token is illegal at this point in the content model. The current state is modified if possible, conserving memory that's already been allocated.

Returns:
next state after reducing a token
Throws:
EndOfInputException