laser.regularlanguage.regularexpression
Class UnaryTreeNode<L extends LabelInterface>

java.lang.Object
  extended by laser.regularlanguage.regularexpression.TreeNode<L>
      extended by laser.regularlanguage.regularexpression.UnaryTreeNode<L>
Type Parameters:
L - The type of Label associated with this regular expression
All Implemented Interfaces:
java.io.Serializable, REConstants
Direct Known Subclasses:
ExponentNode, KleenePlusNode, KleeneStarNode, OptionNode

public abstract class UnaryTreeNode<L extends LabelInterface>
extends TreeNode<L>

The UnaryTreeNode class represents a TreeNode with a single child.

Author:
Heather M. Conboy (laser-software@cs.umass.edu)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class laser.regularlanguage.regularexpression.TreeNode
LS
 
Fields inherited from interface laser.regularlanguage.regularexpression.REConstants
CHOICE, COMMA, COMMENT_PREFIX, CONCATENATION, DOT, EMPTY, EPSILON, EXPONENT, KLEENE_PLUS, KLEENE_STAR, LBRACE, LBRACKET, LPAREN, NOT, OPTION, RANGE, RBRACE, RBRACKET, RPAREN
 
Constructor Summary
protected UnaryTreeNode(TreeNode<L> child)
          Creates a new UnaryTreeNode with the given child.
 
Method Summary
 boolean equalsTree(TreeNode<L> node2)
          Returns true if the tree rooted at this node and the tree rooted at the given node are equal and false otherwise.
 TreeNode<L> getChild()
          Gets the child of this node.
 java.util.List<TreeNode<L>> getChildren()
          Returns a List of the children of this TreeNode.
 java.util.Set<L> getLabelsUsed()
          Returns a Set of the labels used by this TreeNode.
 
Methods inherited from class laser.regularlanguage.regularexpression.TreeNode
apply, copyTree, print, toString, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnaryTreeNode

protected UnaryTreeNode(TreeNode<L> child)
Creates a new UnaryTreeNode with the given child.

Parameters:
child - The child of this node
Method Detail

getChild

public final TreeNode<L> getChild()
Gets the child of this node.

Returns:
The child of this node

getChildren

public java.util.List<TreeNode<L>> getChildren()
Returns a List of the children of this TreeNode.

Specified by:
getChildren in class TreeNode<L extends LabelInterface>
Returns:
A List of the children of this TreeNode

getLabelsUsed

public java.util.Set<L> getLabelsUsed()
Returns a Set of the labels used by this TreeNode.

Specified by:
getLabelsUsed in class TreeNode<L extends LabelInterface>
Returns:
A Set of the labels used by this TreeNode

equalsTree

public boolean equalsTree(TreeNode<L> node2)
Returns true if the tree rooted at this node and the tree rooted at the given node are equal and false otherwise.

NOTE: This will fail to terminate if the tree becomes a cyclic graph.

Overrides:
equalsTree in class TreeNode<L extends LabelInterface>
Parameters:
node2 - The second TreeNode
Returns:
True if this TreeNode and the given TreeNode are equal and false otherwise