Class Arc

java.lang.Object
  |
  +--Arc

public class Arc
extends java.lang.Object

Functions as a word arc and generates a finished constituent. Stores a rule to match, the point up to which components have been matched, and the constituents that match them. Also has a rule associated with it to store the syntactic information and interpretation of the constituent.


Constructor Summary
Arc(Rule newRule)
          Creates an arc using a rule.
 
Method Summary
 Arc addConstituent(Constituent cons)
          Put a new constituent into a copy of this arc.
 boolean canAccept(Constituent cons)
          Check if this arc will accept some constituent as its next element.
 boolean complete()
          Check if this rule is complete.
 Phrase getConstituent(PrologEngine engine)
          Get the finished constituent of this arc.
 java.lang.String toString()
          Spit the string of this arc out-- debugging purposes.
 boolean virtual()
          Check if this arc is virtual or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arc

public Arc(Rule newRule)
Creates an arc using a rule.

Parameters:
newRule - the rule to use.
Throws:
java.lang.RuntimeException - for malformed rule.
Method Detail

toString

public java.lang.String toString()
Spit the string of this arc out-- debugging purposes.

Overrides:
toString in class java.lang.Object
Returns:
a string.

virtual

public boolean virtual()
Check if this arc is virtual or not. It is if it contains only held constituents.

Returns:
if the arc is virtual.

canAccept

public boolean canAccept(Constituent cons)
Check if this arc will accept some constituent as its next element.

Parameters:
cons - the constituent to check.
Returns:
true if it will accept.

addConstituent

public Arc addConstituent(Constituent cons)
Put a new constituent into a copy of this arc.

Parameters:
cons - the constituent to add.
Returns:
a new arc with the constituent added.
Throws:
java.lang.RuntimeException - if the constituent is against the rules.

complete

public boolean complete()
Check if this rule is complete. That is, all its slots are filled.

Returns:
true if the rule is complete.

getConstituent

public Phrase getConstituent(PrologEngine engine)
Get the finished constituent of this arc. If the arc is inconsistent, return a null.

Parameters:
engine - the prolog engine-- we use prolog to check out the relationship between the two.
Returns:
the phrase that is the final constituent of this arc.
Throws:
java.lang.RuntimeException - if not complete.