Fido Alpha 3.2

fido.grammar
Class NodeExpression

java.lang.Object
  |
  +--fido.grammar.NodeExpression
All Implemented Interfaces:
BooleanTreeNode, Expression

public class NodeExpression
extends java.lang.Object
implements Expression

The basic component for a grammar string. Each node contains a String value for the name of the node, a direction the expression links to, whether the node can match multiple nodes, and the next expression node in the full expression.

In the expression, A+ & B-, each A+ and B- would create an NodeExpression class, where A would create a class with the string 'A' as the name, and DIR_RIGHT as the direction.


Field Summary
static int DIR_LEFT
          Value for Direction indicating the expression will link to the left
static int DIR_RIGHT
          Value for Direction indicating the expression will link to the right
 
Constructor Summary
NodeExpression(java.lang.String name, int direction, boolean multi)
          Creates a NODE_TYPE node.
 
Method Summary
 NodeExpression cloneExpression()
          Creates a new NodeExpression with the same values as this expression.
 int getDirection()
          Returns the direction the expression will match.
 java.lang.String getExpressionName()
          Returns the link name of the expression.
 boolean isMultiNodeUsed()
          Returns if the node has been used at least once, which makes it valid.
 boolean isNodeMulti()
          Returns true if the node is a multi node.
 void setMultiNode()
          Sets the node to be a multi node, which means it can match one to many nodes in a grammar.
 void setMultiNodeUsed()
          Sets this node as used at least once in a grammar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIR_LEFT

public static final int DIR_LEFT
Value for Direction indicating the expression will link to the left

See Also:
Constant Field Values

DIR_RIGHT

public static final int DIR_RIGHT
Value for Direction indicating the expression will link to the right

See Also:
Constant Field Values
Constructor Detail

NodeExpression

public NodeExpression(java.lang.String name,
                      int direction,
                      boolean multi)
Creates a NODE_TYPE node.

Method Detail

isNodeMulti

public boolean isNodeMulti()
Returns true if the node is a multi node.

Returns:
true if the node is a multi node.

setMultiNode

public void setMultiNode()
Sets the node to be a multi node, which means it can match one to many nodes in a grammar.


isMultiNodeUsed

public boolean isMultiNodeUsed()
Returns if the node has been used at least once, which makes it valid.

Returns:
true if the node has been used at least once.
See Also:
setMultiNodeUsed()

setMultiNodeUsed

public void setMultiNodeUsed()
Sets this node as used at least once in a grammar.

See Also:
isMultiNodeUsed()

getDirection

public int getDirection()
Returns the direction the expression will match.

See Also:
DIR_LEFT, DIR_RIGHT

getExpressionName

public java.lang.String getExpressionName()
Returns the link name of the expression.

Returns:
String containing the link name of the expression.

cloneExpression

public NodeExpression cloneExpression()
Creates a new NodeExpression with the same values as this expression.

Returns:
a new NodeExpression containing the same values

Fido Alpha 3.2