Class Constant

java.lang.Object
  |
  +--Constant
All Implemented Interfaces:
Node

public class Constant
extends Object
implements Node

Represents a Node with a constant integer value set at construction time. This type of Node has no children, and its String representation is its value as an integer.


Constructor Summary
Constant(int i)
          Constructs a constant node.
 
Method Summary
 Node getChild(int i)
          Returns null
 int getNumChildren()
          A constant has 0 children.
 int getValue()
          Returns the value of the constant
 String toString()
          Returns the string representation of the integer with no surrounding spaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Constant

public Constant(int i)
Constructs a constant node.
Parameters:
i - The value of the node
Method Detail

getValue

public int getValue()
Returns the value of the constant
Specified by:
getValue in interface Node

getNumChildren

public int getNumChildren()
A constant has 0 children.
Specified by:
getNumChildren in interface Node

getChild

public Node getChild(int i)
Returns null
Specified by:
getChild in interface Node

toString

public String toString()
Returns the string representation of the integer with no surrounding spaces.
Specified by:
toString in interface Node
Overrides:
toString in class Object