|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--moses.controlState.UnifyResult
This class represents the result of a unification (or pattern matching) procedure. It maintains a hashtable that maps variables (names starting with '%' symbol in a matching method) into terms for later retrieval. It provides methods for searching in the hashtable for a specific bound variable which returns either the term or its string representation. A typical usage case for the UnifyResult object follows:
Term lt = Term.parse("[role(chair,ceo),department(3),active]");
UnifyResult dep = lt.find("department(%N)");
Term dept = dep.getTerm(); //returns the whole department term
Term depno = dep.getTVar("N"); //returns the number of the department
In an application, a UnifyResult object is not instantiated directly, but it is return, as in the above example, by one of the find or unify methods of the Term object.
| Field Summary | |
static java.lang.String |
VAR
|
java.util.Hashtable |
vars
|
| Constructor Summary | |
UnifyResult()
Default constructor, not used in applications. |
|
UnifyResult(java.util.Hashtable h)
Constructor that creates an UnifyResult object out of a provided hashtable. |
|
UnifyResult(java.util.Hashtable h,
moses.controlState.Term uterm)
Constructor that creates an UnifyResult object out of a provided hashtable and a unified complete term. |
|
| Method Summary | |
java.lang.String |
getSVar(java.lang.String var)
Returns the string representation of the term bound to variable var provided as argument. |
moses.controlState.Term |
getTerm()
This method returns the complete term that has been unified. |
moses.controlState.Term |
getTVar(java.lang.String var)
Returns the term bound to the variable provided as argument. |
moses.controlState.Term |
put(java.lang.String var,
moses.controlState.Term t)
Appends a new binding into the hashtable. |
void |
setTerm(moses.controlState.Term uterm)
This method sets the complete term that has been unified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.util.Hashtable vars
public static final java.lang.String VAR
| Constructor Detail |
public UnifyResult()
public UnifyResult(java.util.Hashtable h)
h - represents the hashtable that holds variable to term mappings.
public UnifyResult(java.util.Hashtable h,
moses.controlState.Term uterm)
h - represents the hashtable that holds variable to term mappings.uterm - represents the unified terms to be set as the result of a matching procedure.| Method Detail |
public moses.controlState.Term put(java.lang.String var,
moses.controlState.Term t)
var - represents the name of the variable to be bound.t - represents the term value to be bound to the variable
public moses.controlState.Term getTVar(java.lang.String var)
var - represents the name of the variable bound during the unification.
public java.lang.String getSVar(java.lang.String var)
var - represents the name of the variable bound during the unification.
public moses.controlState.Term getTerm()
public void setTerm(moses.controlState.Term uterm)
uterm - represents the complete unified (ground) term.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||