net.sf.parser4j.parser.entity.parsestate
Class AbstractParseState

java.lang.Object
  extended by net.sf.parser4j.parser.entity.parsestate.AbstractParseState
All Implemented Interfaces:
java.lang.Iterable<ParseStack>, IParseState
Direct Known Subclasses:
LexParseState, SyntaxParseState

public abstract class AbstractParseState
extends java.lang.Object
implements IParseState

Author:
luc peuvrier

Field Summary
protected  Logger _log
           
protected  boolean acceptAmbiguity
          true if accept ambiguity
protected  int maxNumberOfAlternative
           
protected  ParseStackSet2 parseStackSet
          set of parse stack of this parse state. use map to obtains existing equals element
protected  boolean[] stringTokenRecognition
          for each state define if it is string token recognition
protected  boolean[] tokenRecognition
          for each state define if it is token recognition
 
Constructor Summary
AbstractParseState(boolean acceptAmbiguity, int maxNumberOfAlternative, boolean[] tokenRecognition, boolean[] stringTokenRecognition, ParsingToStringUtil parsingToStringUtil)
           
AbstractParseState(ParsingToStringUtil parsingToStringUtil)
           
 
Method Summary
 boolean add(ParseStack parseStack)
           
 void clear()
          clear the parser stack set
 IParseNode getMatchParseNode()
           
 java.util.List<IParseNode> getParseNodeList()
           
 boolean hasAlternativeForAmbiguity()
           
 boolean isEmpty()
           
 java.util.Iterator<ParseStack> iterator()
           
 boolean remove(ParseStack parseStack)
           
 int size()
           
 ParseStack[] toArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected final Logger _log

acceptAmbiguity

protected final boolean acceptAmbiguity
true if accept ambiguity


parseStackSet

protected final ParseStackSet2 parseStackSet
set of parse stack of this parse state. use map to obtains existing equals element


tokenRecognition

protected final boolean[] tokenRecognition
for each state define if it is token recognition


stringTokenRecognition

protected final boolean[] stringTokenRecognition
for each state define if it is string token recognition


maxNumberOfAlternative

protected int maxNumberOfAlternative
Constructor Detail

AbstractParseState

public AbstractParseState(boolean acceptAmbiguity,
                          int maxNumberOfAlternative,
                          boolean[] tokenRecognition,
                          boolean[] stringTokenRecognition,
                          ParsingToStringUtil parsingToStringUtil)

AbstractParseState

public AbstractParseState(ParsingToStringUtil parsingToStringUtil)
Method Detail

add

public boolean add(ParseStack parseStack)
            throws ParserException,
                   HasAmbiguityParserException
Specified by:
add in interface IParseState
Returns:
true if added, else it is an alternative to existing ( ambiguous)
Throws:
ParserException
HasAmbiguityParserException - reject ambiguity

clear

public void clear()
Description copied from interface: IParseState
clear the parser stack set

Specified by:
clear in interface IParseState

remove

public boolean remove(ParseStack parseStack)
Specified by:
remove in interface IParseState

getMatchParseNode

public IParseNode getMatchParseNode()

iterator

public java.util.Iterator<ParseStack> iterator()
Specified by:
iterator in interface java.lang.Iterable<ParseStack>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IParseState

size

public int size()
Specified by:
size in interface IParseState

toArray

public ParseStack[] toArray()
Specified by:
toArray in interface IParseState
Returns:
parse stack set in array

hasAlternativeForAmbiguity

public boolean hasAlternativeForAmbiguity()

getParseNodeList

public java.util.List<IParseNode> getParseNodeList()


Copyright © 2008-2009 Luc Peuvrier. All Rights Reserved.