adalogo.lang

Class SimpleNode

Implemented Interfaces:
Node
Known Direct Subclasses:
ASTAdditionNode, ASTAndNode, ASTAssignmentIdentifier, ASTAssignmentStatement, ASTBooleanDeclarationNode, ASTCompilationUnit, ASTDashNode, ASTDeclaration, ASTDivisionNode, ASTElsePart, ASTElsifPart, ASTEqualNode, ASTExitStatement, ASTFalseNode, ASTForIdentifier, ASTForReverse, ASTForStatement, ASTForwardStatement, ASTGetXExpression, ASTGetYExpression, ASTGreaterEqualNode, ASTGreaterThanNode, ASTIdentifier, ASTIfStatement, ASTIntegerDeclarationNode, ASTIntegerLiteral, ASTJumpToStatement, ASTLessEqualNode, ASTLessThanNode, ASTLoopStatement, ASTMaxExpression, ASTMinExpression, ASTModNode, ASTMultiplicationNode, ASTNewLineStatement, ASTNotEqualNode, ASTNotNode, ASTNullStatement, ASTOrNode, ASTPenDownStatement, ASTPenUpStatement, ASTProcedureCallStatement, ASTProcedureCallStatementIdentifier, ASTProcedureCallStatementParameters, ASTProcedureDeclaration, ASTProcedureDeclarationIdentifier, ASTProcedureDeclarationParameters, ASTPutLineStatement, ASTPutStatement, ASTRandomExpression, ASTRemNode, ASTResetTurtleStatement, ASTSemi, ASTSequenceOfStatement, ASTStringLiteral, ASTSubtractionNode, ASTTrueNode, ASTTurnStatement, ASTTurnToStatement, ASTVariableDeclaration, ASTVariableDeclarationIdentifier, ASTWhileStatement

public class SimpleNode
extends java.lang.Object
implements Node

Nested Class Summary

Field Summary

protected Node[]
children
protected int
column
protected int
id
protected int
line
protected Node
parent
protected Lang
parser
protected String
value

Constructor Summary

SimpleNode(Lang p, int i)
Constructor of SimpleNode.
SimpleNode(int i)
Constructor of SimpleNode.

Method Summary

Object
childrenAccept(LangVisitor visitor, Object data)
Accept the visitor.
void
dump(String prefix)
Dump the parse tree with param prefix
int
getColumn()
int
getId()
This is for getting the type of the node.
int
getLine()
String
getValue()
return the value of the node.
Object
jjtAccept(LangVisitor visitor, Object data)
Accept the visitor.
void
jjtAddChild(Node n, int i)
AddChild n to the position i.
void
jjtClose()
what it is? dummy.
static Node
jjtCreate(Lang p, int id)
Constructor of Node.
static Node
jjtCreate(int id)
Constructor of Node.
Node
jjtGetChild(int i)
return child at position i
int
jjtGetNumChildren()
return the number of children.
Node
jjtGetParent()
Get parent
void
jjtOpen()
what it is? dummy.
void
jjtSetParent(Node n)
Set parent
void
setColumn(int column)
set beginColumn, where you can find the node.
void
setId(int i)
This is for setting the type of the node.
void
setLine(int line)
set beginLine, where you can find the node.
void
setValue(String value)
set the value for the node.
String
toString()
Get the name of the node, for exmaple SequenceOfStatement etc.
String
toString(String prefix)
Get the name of the node with prefix, for exmaple xxSequenceOfStatement etc.

Field Details

children

protected Node[] children


column

protected int column


id

protected int id


line

protected int line


parent

protected Node parent


parser

protected Lang parser


value

protected String value

Constructor Details

SimpleNode

public SimpleNode(Lang p,
                  int i)
Constructor of SimpleNode. For in-parameter see LangTreeConstants.


SimpleNode

public SimpleNode(int i)
Constructor of SimpleNode. For in-parameter see LangTreeConstants.

Method Details

childrenAccept

public Object childrenAccept(LangVisitor visitor,
                             Object data)
Accept the visitor. *


dump

public void dump(String prefix)
Dump the parse tree with param prefix


getColumn

public int getColumn()

Returns:
the beginColumn of the node, where you can find in the editor window.


getId

public int getId()
This is for getting the type of the node. For example SequenceOfStatement, see LangTreeConstants.java


getLine

public int getLine()

Returns:
the beginLine of the node, where you can find in the editor window.


getValue

public String getValue()
            throws SimpleNode.SimpleNodeGetValueException
return the value of the node.


jjtAccept

public Object jjtAccept(LangVisitor visitor,
                        Object data)
Accept the visitor. *
Specified by:
jjtAccept in interface Node


jjtAddChild

public void jjtAddChild(Node n,
                        int i)
AddChild n to the position i.
Specified by:
jjtAddChild in interface Node


jjtClose

public void jjtClose()
what it is? dummy.
Specified by:
jjtClose in interface Node


jjtCreate

public static Node jjtCreate(Lang p,
                             int id)
Constructor of Node. For in-parameter see LangTreeConstants.


jjtCreate

public static Node jjtCreate(int id)
Constructor of Node. For in-parameter see LangTreeConstants.


jjtGetChild

public Node jjtGetChild(int i)
return child at position i
Specified by:
jjtGetChild in interface Node


jjtGetNumChildren

public int jjtGetNumChildren()
return the number of children.
Specified by:
jjtGetNumChildren in interface Node


jjtGetParent

public Node jjtGetParent()
Get parent
Specified by:
jjtGetParent in interface Node


jjtOpen

public void jjtOpen()
what it is? dummy.
Specified by:
jjtOpen in interface Node


jjtSetParent

public void jjtSetParent(Node n)
Set parent
Specified by:
jjtSetParent in interface Node


setColumn

public void setColumn(int column)
set beginColumn, where you can find the node. this should only use by Lang.jjt


setId

public void setId(int i)
This is for setting the type of the node. For example SequenceOfStatement, see LangTreeConstants.java


setLine

public void setLine(int line)
set beginLine, where you can find the node. this should only use by Lang.jjt


setValue

public void setValue(String value)
set the value for the node.


toString

public String toString()
Get the name of the node, for exmaple SequenceOfStatement etc. see LangConstants


toString

public String toString(String prefix)
Get the name of the node with prefix, for exmaple xxSequenceOfStatement etc. see LangConstants