kites.TRSModel
Class ASTNode

java.lang.Object
  extended by kites.TRSModel.ASTNode
Direct Known Subclasses:
Constant, Function, Variable

public abstract class ASTNode
extends java.lang.Object

Abstract class representing a node in a syntax tree.


Field Summary
protected  java.lang.String name
           
 
Constructor Summary
ASTNode(java.lang.String name)
          Create a node with a name.
 
Method Summary
 void add(ASTNode a)
          Placeholder.
 java.util.Iterator<ASTNode> getChildIterator()
          Return an iterator of the node's children.
 int getLine()
          Deprecated.  
 java.lang.String getName()
           
 int getParamCount()
          Return the number of the node's children.
 java.util.Iterator<ASTNode> getRevChildIterator()
          Return a reverse iterator of the node's children.
 int getSize()
          Used to compute the size of a term.
 void reverse()
          Reverse the order of the node's children.
abstract  NodeContainer toLabel()
          Return the graphical representation of this node.
abstract  NodeContainer toLabelWithRule(java.util.LinkedHashMap<ASTNode,java.util.LinkedList<Rule>> decomp, boolean highlight)
          Return the graphical representation of this node and also embed information about the possible rewrites into it.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String indent)
          return an indented string representation of the node (the name)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Constructor Detail

ASTNode

public ASTNode(java.lang.String name)
Create a node with a name.

Parameters:
name - The node's name
Method Detail

getName

public java.lang.String getName()
Returns:
The node's name

getLine

public int getLine()
Deprecated. 

Not used at the moment

Returns:
always 0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the node (the name)

toString

public java.lang.String toString(java.lang.String indent)
return an indented string representation of the node (the name)

Parameters:
indent - The number of spaces to indent
Returns:
the indented string representations

add

public void add(ASTNode a)
Placeholder. Only used for Functions.

Parameters:
a - no function

getChildIterator

public java.util.Iterator<ASTNode> getChildIterator()
                                             throws NoChildrenException
Return an iterator of the node's children. Must be overridden to do something useful.

Returns:
none
Throws:
NoChildrenException - Always thrown

getRevChildIterator

public java.util.Iterator<ASTNode> getRevChildIterator()
                                                throws NoChildrenException
Return a reverse iterator of the node's children. Must be overridden to do something useful.

Returns:
none
Throws:
NoChildrenException - Always thrown

getParamCount

public int getParamCount()
Return the number of the node's children.

Returns:
always 0

getSize

public int getSize()
Used to compute the size of a term. An ASTNode has a size of 1.

Returns:
always 1

reverse

public void reverse()
Reverse the order of the node's children.


toLabel

public abstract NodeContainer toLabel()
Return the graphical representation of this node.

Returns:
The node's graphical representation

toLabelWithRule

public abstract NodeContainer toLabelWithRule(java.util.LinkedHashMap<ASTNode,java.util.LinkedList<Rule>> decomp,
                                              boolean highlight)
Return the graphical representation of this node and also embed information about the possible rewrites into it.

Parameters:
decomp - map of the nodes and their possible rewrites
Returns:
The node's graphical representation