kites.TRSModel
Class Function

java.lang.Object
  extended by kites.TRSModel.ASTNode
      extended by kites.TRSModel.Function

public class Function
extends ASTNode

This class represents a function symbol in a TRS. Function symbols can have one or more children and are derived from ASTNode

See Also:
ASTNode

Field Summary
private  java.util.LinkedList<ASTNode> children
           
private  boolean reversed
           
 
Fields inherited from class kites.TRSModel.ASTNode
name
 
Constructor Summary
Function(java.lang.String name)
          Create a new function with a name
 
Method Summary
 void add(ASTNode child)
          Add a child (in form of an ASTNode to this function.
 java.util.Iterator<ASTNode> getChildIterator()
          Gives an iterator over all the function's children
 int getParamCount()
          Give the number of parameters (i.
 java.util.Iterator<ASTNode> getRevChildIterator()
          Gives a reversed iterator over all the function's children
 int getSize()
          Give the size of this function.
 void reverse()
          Reverse the order of the children
 NodeContainer toLabel()
          Return a graphical representation of this function
 NodeContainer toLabelWithRule(java.util.LinkedHashMap<ASTNode,java.util.LinkedList<Rule>> decomp, boolean highlight)
          Return a graphical representation of this function and embed information about the rules which can be applied to this node.
 java.lang.String toString()
          Give a string representation of this function
 
Methods inherited from class kites.TRSModel.ASTNode
getLine, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

private java.util.LinkedList<ASTNode> children

reversed

private boolean reversed
Constructor Detail

Function

public Function(java.lang.String name)
Create a new function with a name

Parameters:
name - The function's name
Method Detail

add

public void add(ASTNode child)
Add a child (in form of an ASTNode to this function.

Overrides:
add in class ASTNode
Parameters:
child - The child node (or possibly tree) to add

toString

public java.lang.String toString()
Give a string representation of this function

Overrides:
toString in class ASTNode
Returns:
The function's string representation

getChildIterator

public java.util.Iterator<ASTNode> getChildIterator()
Gives an iterator over all the function's children

Overrides:
getChildIterator in class ASTNode
Returns:
The iterator over the children

getRevChildIterator

public java.util.Iterator<ASTNode> getRevChildIterator()
Gives a reversed iterator over all the function's children

Overrides:
getRevChildIterator in class ASTNode
Returns:
The reversed iterator

getParamCount

public int getParamCount()
Give the number of parameters (i. e. children) this function has.

Overrides:
getParamCount in class ASTNode
Returns:
The number of children.

getSize

public int getSize()
Give the size of this function. This is different from getParentCount(), as a child can also be another function, which has a size greater than 1.

Overrides:
getSize in class ASTNode
Returns:
The subtrees size

reverse

public void reverse()
Reverse the order of the children

Overrides:
reverse in class ASTNode

toLabel

public NodeContainer toLabel()
Return a graphical representation of this function

Specified by:
toLabel in class ASTNode
Returns:
The graphical representation

toLabelWithRule

public NodeContainer toLabelWithRule(java.util.LinkedHashMap<ASTNode,java.util.LinkedList<Rule>> decomp,
                                     boolean highlight)
Return a graphical representation of this function and embed information about the rules which can be applied to this node.

Specified by:
toLabelWithRule in class ASTNode
Parameters:
highlight - Shall the function be highlighted initially if rules apply?
decomp - map of the nodes and their possible rewrites
Returns:
The node's graphical representation