Fido Alpha 3.2

fido.grammar
Class SentenceThread

java.lang.Object
  |
  +--fido.grammar.SentenceThread

public class SentenceThread
extends java.lang.Object

Represents one possible linkage the grammar has found during incremental processing. Each or found in a grammar expression creates two new SentenceThreads, one for each possible outcome.

Each SentenceThread contains a GrammarStack where it stores open links for matching later in processing and a Vector of discovered Link classes.

Each thread contains an incremented counter as a name. Every new SentenceThread contains a different name, within the same parse.

See Also:
GrammarStack

Constructor Summary
SentenceThread(java.lang.String name)
          Creates a new SentenceThread instance.
 
Method Summary
 void addLink(Link newLink)
          Adds a new Link class to the thread.
 boolean checkStack()
          Asks the GrammarStack if its stack is empty.
 SentenceThread cloneSentenceThread(java.lang.String newName)
          Creates a shallow copy of the SentenceThread.
 GrammarStack getGrammarStack()
          Returns a reference to the GrammarStack.
 java.util.Vector getLinks()
          Returns a reference to the Vector of links accumilated by this sentence thread.
 java.lang.String getThreadName()
          Returns the name of the thead.
 void holdExpression(NodeExpression exp, WordSense sense)
          Puts the NodeExpression parameter, and associated WordSense, in the hold area of the GrammarStack.
 void pushHoldNode()
          Asks the GrammarStack to push the node in the hold area to the top of the stack.
 WordSense traverseStack(java.lang.String str)
          Asks the GrammarStack to look for an open link matching the name in the parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SentenceThread

public SentenceThread(java.lang.String name)
Creates a new SentenceThread instance. This class should be created from the SentenceThreadFactory class.

Parameters:
name - Name of the thread.
See Also:
SentenceThreadFactory
Method Detail

getLinks

public java.util.Vector getLinks()
Returns a reference to the Vector of links accumilated by this sentence thread.

Returns:
Vector of Link classes.

getGrammarStack

public GrammarStack getGrammarStack()
Returns a reference to the GrammarStack.

Returns:
The GrammarStack for this sentence thread.

holdExpression

public void holdExpression(NodeExpression exp,
                           WordSense sense)
Puts the NodeExpression parameter, and associated WordSense, in the hold area of the GrammarStack.

Parameters:
exp - NodeExpression to put in the hold area.
sense - WordSense associated with the grammar expression.
See Also:
GrammarStack.holdExpression(NodeExpression, WordSense)

traverseStack

public WordSense traverseStack(java.lang.String str)
Asks the GrammarStack to look for an open link matching the name in the parameter.

Parameters:
str - Name of the close link to look for.
Returns:
WordSense of the matching word. Null if one is not found.
See Also:
GrammarStack.traverseStack(String)

pushHoldNode

public void pushHoldNode()
Asks the GrammarStack to push the node in the hold area to the top of the stack. This is done after all of the expressions in the current word has been processed.

See Also:
GrammarStack.push()

checkStack

public boolean checkStack()
Asks the GrammarStack if its stack is empty.

Returns:
True if the stack is empty. False otherwise.
See Also:
GrammarStack.isEmpty()

addLink

public void addLink(Link newLink)
Adds a new Link class to the thread.

Parameters:
newLink - Link class to add.

getThreadName

public java.lang.String getThreadName()
Returns the name of the thead.

Returns:
Name of the thread.

cloneSentenceThread

public SentenceThread cloneSentenceThread(java.lang.String newName)
Creates a shallow copy of the SentenceThread.

Returns:
Clone of the SentenceThread.

Fido Alpha 3.2