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

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

public class KleeneStarNode<L extends LabelInterface>
extends UnaryTreeNode<L>

KleeneStarNode represents a Kleene Star (*) in the regular expression, meaning the expression occurs zero or more times. This node has one child, which represents the regular expression that the Kleene Star operates on.

Author:
Jamieson M. Cobleigh (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
KleeneStarNode(TreeNode<L> child)
          Creates a new KleeneStarNode
 
Method Summary
 void apply(REVisitor<L> visitor, java.lang.Object context)
          Applies the given Visitor to this TreeNode.
 KleeneStarNode<L> copyTree()
          Returns a copy of the Tree rooted at this node.
 java.lang.String print(java.lang.String prefix)
          Prints the Tree rooted at this node.
 
Methods inherited from class laser.regularlanguage.regularexpression.UnaryTreeNode
equalsTree, getChild, getChildren, getLabelsUsed
 
Methods inherited from class laser.regularlanguage.regularexpression.TreeNode
toString, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KleeneStarNode

public KleeneStarNode(TreeNode<L> child)
Creates a new KleeneStarNode

Parameters:
child - the TreeNode that represents the regular expession that this Kleene Star operates on
Method Detail

apply

public void apply(REVisitor<L> visitor,
                  java.lang.Object context)
           throws REVisitorException
Applies the given Visitor to this TreeNode.

Specified by:
apply in class TreeNode<L extends LabelInterface>
Parameters:
visitor - The Visitor to be applied
context - The calling context
Throws:
REVisitorException - if an error occurs

copyTree

public KleeneStarNode<L> copyTree()
Returns a copy of the Tree rooted at this node. This will fail to terminate if the tree becomes a cyclic graph.

Specified by:
copyTree in class TreeNode<L extends LabelInterface>
Returns:
a copy of the Tree rooted at this node

print

public java.lang.String print(java.lang.String prefix)
Prints the Tree rooted at this node. This will fail to terminate if the tree becomes a cyclic graph.

Specified by:
print in class TreeNode<L extends LabelInterface>
Parameters:
prefix - The string to be appended before everything printed for this level. Should be a String of spaces
Returns:
A string representation of this TreeNode