asd
Class ASDGrammarNode

java.lang.Object
  extended by asd.ASDGrammarNode

public class ASDGrammarNode
extends java.lang.Object

Instances are nodes in an ASDGrammar

Author:
James A. Mason

Field Summary
protected  boolean hasIncoming
           
protected  boolean nodeBegins
           
protected  java.util.ArrayList<java.lang.String> nodeBeginsTypes
           
protected  java.lang.String nodeInstance
           
protected  java.lang.String nodePhraseType
           
protected  java.lang.String nodeSemanticAction
           
protected  java.lang.String nodeSemanticValue
           
protected  java.util.ArrayList<ASDGrammarSuccessor> nodeSuccessors
           
protected  java.util.ArrayList<java.lang.String> nodeSuccessorTypes
           
protected  java.lang.String nodeWord
           
protected  short xCoordinate
           
protected  short yCoordinate
           
 
Constructor Summary
ASDGrammarNode(java.lang.String word, java.lang.String instance, boolean begins, java.util.ArrayList<java.lang.String> beginsTypes, java.util.ArrayList<ASDGrammarSuccessor> successors, java.util.ArrayList<java.lang.String> successorTypes, java.lang.String phraseType, java.lang.String semanticValue, java.lang.String semanticAction)
          Initializes a new ASDGrammarNode.
 
Method Summary
 java.util.ArrayList<java.lang.String> beginsTypes()
          Returns a list of strings that name the phrase types that can begin, directly or indirectly, at the node (if it is an initial node); returns null if the node is not initial or if the phrase types that it can begin are not known specifically.
 short getXCoordinate()
          Returns the horizontal pixel coordinate of the node.
 short getYCoordinate()
          Returns the vertical pixel coordinate of the node.
 java.lang.String instance()
          Returns the String that indicates the instance of the word in the grammar that is represented by the node.
 boolean isFinal()
          Indicates whether or not the node is a final one in the grammar -- that is, whether it ends a phrase.
 boolean isInitial()
          Indicates whether or not the node is an initial one in the grammar -- that is, whether it can begin a phrase.
 java.lang.String phraseType()
          Returns a String that names the phrase type that ends at the node, if the node is a final node; returns null if the string is not a final node.
 java.lang.String semanticAction()
          Returns the semantic action String for the node, or null if it has no semantic action to perform.
 java.lang.String semanticValue()
          Returns the semantic value String for the node, or null if it has no semantic value to compute
 java.util.ArrayList<ASDGrammarSuccessor> successors()
          Returns a list of successor instances of the node, if it is not a final node in the grammar (each successor instance is represented by an ASDGrammarSuccessor instance); returns null if the node is a final node.
 java.util.ArrayList<java.lang.String> successorTypes()
          Returns a list of Strings that name the phrase types that occur in successors of the node, if it is not a final node; returns null if the node has some unspecified phrase types in successors, or if the node is a final node.
 java.lang.String toString()
          Returns a String that represents an ASDGrammarNode in character form optimized for parsing.
 java.lang.String toString(boolean optimize)
          Returns a String that represents an ASDGrammarNode in character form, as used for the representation of a word instance in the character file representation of an ASD grammar.
 java.lang.String word()
          Returns the word in the node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeWord

protected java.lang.String nodeWord

nodeInstance

protected java.lang.String nodeInstance

nodeBegins

protected boolean nodeBegins

nodeBeginsTypes

protected java.util.ArrayList<java.lang.String> nodeBeginsTypes

nodeSuccessors

protected java.util.ArrayList<ASDGrammarSuccessor> nodeSuccessors

nodeSuccessorTypes

protected java.util.ArrayList<java.lang.String> nodeSuccessorTypes

nodePhraseType

protected java.lang.String nodePhraseType

nodeSemanticValue

protected java.lang.String nodeSemanticValue

nodeSemanticAction

protected java.lang.String nodeSemanticAction

xCoordinate

protected short xCoordinate

yCoordinate

protected short yCoordinate

hasIncoming

protected boolean hasIncoming
Constructor Detail

ASDGrammarNode

public ASDGrammarNode(java.lang.String word,
                      java.lang.String instance,
                      boolean begins,
                      java.util.ArrayList<java.lang.String> beginsTypes,
                      java.util.ArrayList<ASDGrammarSuccessor> successors,
                      java.util.ArrayList<java.lang.String> successorTypes,
                      java.lang.String phraseType,
                      java.lang.String semanticValue,
                      java.lang.String semanticAction)
Initializes a new ASDGrammarNode. Pixel coordinates are set to 0, 0 by default.

Parameters:
word - the vocabulary element for which the node represents an instance
instance - the instance index of the node
begins - indicates whether or not the node can begin a phrase
beginsTypes - indicates what types of phrase (if any) can begin at the node; null indicates unspecified types
successors - lists pairs (word instance-index) of successors of the node in the grammar, if any; null indicates that the node is a final node
successorTypes - lists the phrase types in the successor nodes (if any); if successors is not null, null here indicates that there are successor phrase types with unspecified names
phraseType - names the phrase type that ends at the node, if the node is a final one
semanticValue - a String to be evaluated as the semantic value of the completed phrase, if the node is a final one; null indicates no semantic value to be computed
semanticAction - a String to be evaluated when the node is entered during a parse; null indicates no semantic action to be performed
Method Detail

beginsTypes

public java.util.ArrayList<java.lang.String> beginsTypes()
Returns a list of strings that name the phrase types that can begin, directly or indirectly, at the node (if it is an initial node); returns null if the node is not initial or if the phrase types that it can begin are not known specifically.


getXCoordinate

public short getXCoordinate()
Returns the horizontal pixel coordinate of the node.


getYCoordinate

public short getYCoordinate()
Returns the vertical pixel coordinate of the node.


instance

public java.lang.String instance()
Returns the String that indicates the instance of the word in the grammar that is represented by the node.


isFinal

public boolean isFinal()
Indicates whether or not the node is a final one in the grammar -- that is, whether it ends a phrase.


isInitial

public boolean isInitial()
Indicates whether or not the node is an initial one in the grammar -- that is, whether it can begin a phrase.


phraseType

public java.lang.String phraseType()
Returns a String that names the phrase type that ends at the node, if the node is a final node; returns null if the string is not a final node.


semanticAction

public java.lang.String semanticAction()
Returns the semantic action String for the node, or null if it has no semantic action to perform.


semanticValue

public java.lang.String semanticValue()
Returns the semantic value String for the node, or null if it has no semantic value to compute


successors

public java.util.ArrayList<ASDGrammarSuccessor> successors()
Returns a list of successor instances of the node, if it is not a final node in the grammar (each successor instance is represented by an ASDGrammarSuccessor instance); returns null if the node is a final node.


successorTypes

public java.util.ArrayList<java.lang.String> successorTypes()
Returns a list of Strings that name the phrase types that occur in successors of the node, if it is not a final node; returns null if the node has some unspecified phrase types in successors, or if the node is a final node.


toString

public java.lang.String toString()
Returns a String that represents an ASDGrammarNode in character form optimized for parsing.

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean optimize)
Returns a String that represents an ASDGrammarNode in character form, as used for the representation of a word instance in the character file representation of an ASD grammar.

Parameters:
optimize - indicates whether or not the node should be converted to a form that is optimized for parsing.

word

public java.lang.String word()
Returns the word in the node