net.sf.parser4j.parser.entity.parsenode
Class AbstractParseNode

java.lang.Object
  extended by net.sf.parser4j.parser.entity.parsenode.AbstractParseNode
All Implemented Interfaces:
IParseNode
Direct Known Subclasses:
AbstractNonTerminalParseNode, AbstractTerminalParseNode

public abstract class AbstractParseNode
extends java.lang.Object
implements IParseNode

common to all parse node

Author:
luc peuvrier

Field Summary
protected  Logger _log
           
protected  int beginColumnNumber
           
protected  int beginLineNumber
           
protected  boolean computeSyntaxNode
           
protected  IParseNodeData data
           
protected  IParseNodeData[] dataByAlternative
          data associated to this parse node by alternative
protected  int endColumnNumber
           
protected  int endLineNumber
           
protected  java.lang.String fileName
           
protected  int grammarSymbolIdentifier
          grammar symbol identifier of this parse node
protected  boolean intermediate
           
protected  java.lang.String matchIdentifier
           
protected  ParseSession parseSession
           
protected  ParsingToStringUtil parsingToStringUtil
           
protected  SyntaxNode syntaxNode
           
protected  boolean whiteSpace
           
 
Constructor Summary
protected AbstractParseNode(EnumNodeType parseNodeType, int grammarSymbolIdentifier, ParseSession parseSession, int parseStackId, ParsingToStringUtil parsingToStringUtil, boolean intermediate, boolean computeSyntaxNode)
           
protected AbstractParseNode(EnumNodeType parseNodeType, ParseSession parseSession, int parseStackId, ParsingToStringUtil parsingToStringUtil, boolean computeSyntaxNode)
           
 
Method Summary
 void addErrorStatus(IParseNode[] sonParseNodes)
           
 void addErrorStatus(IParseNodeInErrorStatus status)
          add error status
 boolean equals(java.lang.Object obj)
           
 int getBeginColumnNumber()
           
 int getBeginLineNumber()
           
 int getEndColumnNumber()
           
 int getEndLineNumber()
           
 java.util.List<IParseNodeInErrorStatus> getErrorStatusList()
           
 java.lang.String getFileName()
           
 int getGrammarSymbolIdentifier()
           
 int getMyIdentifier()
           
 java.lang.String getName()
           
 EnumNodeType getParseNodeType()
           
 int getParseStackId()
           
 boolean hasDataComputed()
           
 int hashCode()
           
 boolean isInError()
           
 boolean isIntermediate()
           
 boolean isNonTerminal()
           
 boolean isTerminal()
           
 boolean isWhiteSpace()
           
 void setData(IParseNodeData data)
           
 void setInTextInformation(java.lang.String fileName, int beginLineNumber, int beginColumnNumber, int endLineNumber, int endColumnNumber)
          set source file name and begin/end line/column number
 void setMatchIdentifier(java.lang.String matchIdentifier)
           
 void setWhiteSpace(boolean whiteSpace)
           
 java.lang.String toString()
           
 java.lang.String toString(boolean visitAgainEnabled)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.parser4j.parser.entity.parsenode.IParseNode
accept, assertSonReferenced, getAlternativeParseNodeArray, getDataByAlternative, getNotWhiteIndexes, getNumberOfAlternative, getSonParseNodes, getSyntaxNode, getUniqData, setAlternativeParseNode, setData, unreferenceSon
 

Field Detail

_log

protected transient Logger _log

parsingToStringUtil

protected final ParsingToStringUtil parsingToStringUtil

grammarSymbolIdentifier

protected int grammarSymbolIdentifier
grammar symbol identifier of this parse node


intermediate

protected final boolean intermediate

fileName

protected java.lang.String fileName

beginLineNumber

protected int beginLineNumber

beginColumnNumber

protected int beginColumnNumber

endLineNumber

protected int endLineNumber

endColumnNumber

protected int endColumnNumber

whiteSpace

protected boolean whiteSpace

parseSession

protected ParseSession parseSession

dataByAlternative

protected IParseNodeData[] dataByAlternative
data associated to this parse node by alternative


data

protected IParseNodeData data

syntaxNode

protected SyntaxNode syntaxNode

computeSyntaxNode

protected final boolean computeSyntaxNode

matchIdentifier

protected java.lang.String matchIdentifier
Constructor Detail

AbstractParseNode

protected AbstractParseNode(EnumNodeType parseNodeType,
                            int grammarSymbolIdentifier,
                            ParseSession parseSession,
                            int parseStackId,
                            ParsingToStringUtil parsingToStringUtil,
                            boolean intermediate,
                            boolean computeSyntaxNode)

AbstractParseNode

protected AbstractParseNode(EnumNodeType parseNodeType,
                            ParseSession parseSession,
                            int parseStackId,
                            ParsingToStringUtil parsingToStringUtil,
                            boolean computeSyntaxNode)
Method Detail

hasDataComputed

public boolean hasDataComputed()
Specified by:
hasDataComputed in interface IParseNode
Returns:
true if data associated to the parse node is computed or terminal parse node

setData

public void setData(IParseNodeData data)
             throws ParserException
Specified by:
setData in interface IParseNode
Parameters:
data - data associated to this parse node first alternative
Throws:
ParserException

getParseStackId

public int getParseStackId()
Specified by:
getParseStackId in interface IParseNode
Returns:
the parse stack identification number of this parse node

getMyIdentifier

public int getMyIdentifier()
Specified by:
getMyIdentifier in interface IParseNode
Returns:
this parse node identifier, do not confuse with grammar symbol identifier

getParseNodeType

public EnumNodeType getParseNodeType()
Specified by:
getParseNodeType in interface IParseNode
Returns:
the parse node type

getGrammarSymbolIdentifier

public int getGrammarSymbolIdentifier()
Specified by:
getGrammarSymbolIdentifier in interface IParseNode
Returns:
non terminal identifier of this parse node

isIntermediate

public boolean isIntermediate()
Specified by:
isIntermediate in interface IParseNode

getName

public java.lang.String getName()
Specified by:
getName in interface IParseNode

isWhiteSpace

public boolean isWhiteSpace()
Specified by:
isWhiteSpace in interface IParseNode
Returns:
true if the matched non terminal of this parse node is a white space

setWhiteSpace

public void setWhiteSpace(boolean whiteSpace)
Specified by:
setWhiteSpace in interface IParseNode
Parameters:
whiteSpace - true if the matched non terminal of this parse node is a white space

isNonTerminal

public boolean isNonTerminal()
Specified by:
isNonTerminal in interface IParseNode
Returns:
true if this parse node is a non terminal

isTerminal

public boolean isTerminal()
Specified by:
isTerminal in interface IParseNode
Returns:
true if this parse node is a terminal

setInTextInformation

public void setInTextInformation(java.lang.String fileName,
                                 int beginLineNumber,
                                 int beginColumnNumber,
                                 int endLineNumber,
                                 int endColumnNumber)
Description copied from interface: IParseNode
set source file name and begin/end line/column number

Specified by:
setInTextInformation in interface IParseNode

getFileName

public java.lang.String getFileName()
Specified by:
getFileName in interface IParseNode
Returns:
file name source of this parse node

getBeginLineNumber

public int getBeginLineNumber()
Specified by:
getBeginLineNumber in interface IParseNode
Returns:
begin line number

getEndLineNumber

public int getEndLineNumber()
Specified by:
getEndLineNumber in interface IParseNode
Returns:
end line number

getBeginColumnNumber

public int getBeginColumnNumber()
Specified by:
getBeginColumnNumber in interface IParseNode
Returns:
begin column number

getEndColumnNumber

public int getEndColumnNumber()
Specified by:
getEndColumnNumber in interface IParseNode
Returns:
end column number

isInError

public boolean isInError()
Specified by:
isInError in interface IParseNode
Returns:
See Also:
net.sf.parser4j.parser.entity.parsenode.status.IParseNodeStatus#isInError()

getErrorStatusList

public java.util.List<IParseNodeInErrorStatus> getErrorStatusList()
Specified by:
getErrorStatusList in interface IParseNode
Returns:
the error status list, null if no error

addErrorStatus

public void addErrorStatus(IParseNode[] sonParseNodes)
Specified by:
addErrorStatus in interface IParseNode

addErrorStatus

public void addErrorStatus(IParseNodeInErrorStatus status)
Description copied from interface: IParseNode
add error status

Specified by:
addErrorStatus in interface IParseNode
Parameters:
status - the error status

setMatchIdentifier

public void setMatchIdentifier(java.lang.String matchIdentifier)
Specified by:
setMatchIdentifier in interface IParseNode

toString

public java.lang.String toString(boolean visitAgainEnabled)
Specified by:
toString in interface IParseNode

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


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