public class SimpleNode extends java.lang.Object implements Node, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected Node[] |
children |
protected int |
id |
protected Node |
parent |
protected Parser |
parser |
| Constructor and Description |
|---|
SimpleNode(int i)
Default constructor supplying the node with its type id.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Node e) |
void |
dump(java.lang.String prefix)
Dump the children hierarchy.
|
java.lang.Object |
eval(CallStack callstack,
Interpreter interpreter)
This is the general signature for evaluation of a node.
|
int |
getId()
Return the node type ID.
|
int |
getLineNumber()
Get the line number of the starting token
|
java.lang.String |
getSourceFile()
Get the name of the source file (or more generally source) of the text
from which this node was parsed.
|
java.lang.String |
getText()
Get the text of the tokens comprising this node.
|
boolean |
hasNext() |
boolean |
hasPrevious() |
void |
jjtAddChild(Node n,
int i)
Add argument to the list of children.
|
void |
jjtClose()
Called after all the child nodes have been added.
|
Node |
jjtGetChild(int i)
Returns the child node at the given index.
|
Node[] |
jjtGetChildren()
Return the list of child nodes..
|
int |
jjtGetNumChildren()
Return the number of children the node has.
|
Node |
jjtGetParent()
Return node parent.
|
void |
jjtOpen()
Called after the node has been made the current node.
|
void |
jjtSetParent(Node n)
Inform the node of its parent.
|
Node |
next() |
int |
nextIndex() |
Node |
previous() |
int |
previousIndex() |
void |
remove() |
void |
set(Node e) |
void |
setSourceFile(java.lang.String sourceFile)
Set the name of the source file (or more generally source) of the text
from which this node was parsed.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String prefix)
Overloaded toString with prefix used by dump.
|
protected Node parent
protected Node[] children
protected int id
protected Parser parser
public SimpleNode(int i)
i - type index of ParserTreeConstants.jjtNodeNamepublic boolean hasPrevious()
hasPrevious in interface java.util.ListIterator<Node>public boolean hasNext()
public int nextIndex()
nextIndex in interface java.util.ListIterator<Node>public int previousIndex()
previousIndex in interface java.util.ListIterator<Node>public Node next()
public void remove()
public void jjtOpen()
public void jjtClose()
public void jjtSetParent(Node n)
jjtSetParent in interface Nodepublic Node jjtGetParent()
jjtGetParent in interface Nodepublic void jjtAddChild(Node n, int i)
jjtAddChild in interface Noden - the child node to addi - index of child nodepublic Node jjtGetChild(int i)
jjtGetChild in interface Nodei - child indexpublic Node[] jjtGetChildren()
jjtGetChildren in interface Nodepublic int jjtGetNumChildren()
jjtGetNumChildren in interface Nodepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String prefix)
public void dump(java.lang.String prefix)
public java.lang.Object eval(CallStack callstack, Interpreter interpreter) throws EvalError
public void setSourceFile(java.lang.String sourceFile)
setSourceFile in interface NodesourceFile - sourcepublic java.lang.String getSourceFile()
getSourceFile in interface Nodepublic int getLineNumber()
getLineNumber in interface Nodepublic java.lang.String getText()