com.singularsys.jep.parser
Class ASTVarNode

java.lang.Object
  extended by com.singularsys.jep.parser.SimpleNode
      extended by com.singularsys.jep.parser.ASTVarNode
All Implemented Interfaces:
Node

public class ASTVarNode
extends SimpleNode

Variable Node


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.singularsys.jep.parser.Node
Node.HookKey
 
Field Summary
 
Fields inherited from class com.singularsys.jep.parser.SimpleNode
children, id, keys, parent, parser, vals
 
Constructor Summary
ASTVarNode(int id)
           
ASTVarNode(Parser p, int id)
           
 
Method Summary
 java.lang.String getName()
          Returns the name of the variable.
 Operator getOperator()
          Return the operator associated with a Node (if any)
 PostfixMathCommandI getPFMC()
          Return the pfmc of a node (if any)
 java.lang.Object getValue()
          Return the value represented by the variable
 Variable getVar()
          Return the variable associated with a Node (if any)
 java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
          Accept the visitor.
 void setVar(Variable variable)
          Sets the name of the variable.
 java.lang.String toString()
          Creates a string containing the variable's name and value
 
Methods inherited from class com.singularsys.jep.parser.SimpleNode
childIterator, children, childrenAccept, dump, getHook, getId, hookKeys, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, removeHook, setHook, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASTVarNode

public ASTVarNode(int id)

ASTVarNode

public ASTVarNode(Parser p,
                  int id)
Method Detail

jjtAccept

public java.lang.Object jjtAccept(ParserVisitor visitor,
                                  java.lang.Object data)
                           throws JepException
Accept the visitor.

Specified by:
jjtAccept in interface Node
Overrides:
jjtAccept in class SimpleNode
Throws:
JepException

setVar

public void setVar(Variable variable)
Sets the name of the variable.


getVar

public Variable getVar()
Description copied from interface: Node
Return the variable associated with a Node (if any)

Returns:
The Variable for ASTVarNodes, null otherwise

getName

public java.lang.String getName()
Returns the name of the variable.

Returns:
the name if an ASTVarNode, ASTFunNode, ASTOpNode, null otherwise

getValue

public java.lang.Object getValue()
Return the value represented by the variable

Returns:
the value or null if no variable is defined.

toString

public java.lang.String toString()
Creates a string containing the variable's name and value

Overrides:
toString in class java.lang.Object

getOperator

public Operator getOperator()
Description copied from interface: Node
Return the operator associated with a Node (if any)

Returns:
The Operator for ASTOpNodes, null otherwise

getPFMC

public PostfixMathCommandI getPFMC()
Description copied from interface: Node
Return the pfmc of a node (if any)

Returns:
the PostfixMathCommand for ASTFunNode and ASTOpNode, null otherwise


Copyright © 2010 Singular Systems http://www.singularsys.com/jep