|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--UnificationTable
UnificationTable.java A unification table is required to keep track of which Variables have been matched against each other; otherwise transitivity might be lost through a series of pairwise comparisons, i.e ?z matches ?x, ?x matches Apple, what does ?z match now? store ?z/?x/Apple in table Every variable has two identities: a set of variables and possibly one constant to which it is bound (stored in "ht"); and a substitution set that lists possible additional bindings under consideration by the unification process (stored in "subs"). Created: Fri Apr 16 16:04:19 1999
Field Summary | |
(package private) static boolean |
DEBUG
|
(package private) static java.lang.String |
em
|
private java.util.Hashtable |
ht
|
(package private) static java.lang.String |
loc
|
private java.util.Hashtable |
subs
|
Constructor Summary | |
UnificationTable()
|
Method Summary | |
void |
add(Variable key,
java.lang.Object value)
Always adds key to vector of values so that when two sets of values are merged, we know both sources. |
private void |
addSubstitutions(Variable v1,
java.lang.Object o2)
Polymorphic, to the extent that java is. |
private void |
addSubstitutions(Variable var1,
Variable var2)
|
void |
clear()
|
void |
clearSubstitutions()
|
java.lang.Object |
clone()
|
boolean |
findSamePredicateSubstitutions(Predicate p1,
Predicate p2)
Attempt to find a substitution that can unify the three fields of the predicates. |
SetVector |
get(Variable key)
Returns the binding of a variable if it exists, otherwise binds it to empty SetVector. |
private java.lang.Object |
getConstant(Variable key)
Returns the constant binding of a variable if it exists, otherwise returns null. |
Predicate |
getConstantPredicate(Predicate p)
Return a predicate with all variables replaced by constants if they exist, otherwise return null. |
private boolean |
getNewSubstitutions(java.lang.Object o1,
java.lang.Object o2)
If a variable can be unified with an object or variable within the context of previous substitutions, then true is returned (can't just change the UT.ht because rest of predicate might not unify, or might want to try other combos.) Returns NULL if no valid substitution exists. |
private boolean |
getNewSubstitutions(java.lang.Object o2,
Variable var1)
|
private boolean |
getNewSubstitutions(Variable var1,
java.lang.Object o2)
|
private boolean |
getNewSubstitutions(Variable var1,
Variable var2)
|
Predicate |
getPredicateWithMoreConstants(Predicate p)
Return a predicate with as many variables as possible replaced by constants; if at least one variable is replaced, return a new predicate; else return null. |
private java.lang.Object |
getSubsConstant(Variable v1)
|
private SetVector |
getVariableSubstitutions(Variable v)
If there are already substitutions in the subs table, get them. |
private boolean |
isBound(Variable key)
Returns true if Variable is bound to a non-empty set. |
private boolean |
isBoundTo(Variable key,
java.lang.Object value)
|
static void |
main(java.lang.String[] args)
|
void |
makeSubstitutions()
|
Predicate |
subGetPredicateWithMoreConstants(Predicate p)
|
java.lang.String |
toString()
|
private SetVector |
unionSubstitutions(Variable v1,
Variable v2)
|
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.Hashtable ht
private java.util.Hashtable subs
static boolean DEBUG
static java.lang.String em
static java.lang.String loc
Constructor Detail |
public UnificationTable()
Method Detail |
public java.lang.Object clone()
public void add(Variable key, java.lang.Object value)
public SetVector get(Variable key)
private java.lang.Object getConstant(Variable key)
public Predicate getConstantPredicate(Predicate p)
public Predicate getPredicateWithMoreConstants(Predicate p)
public Predicate subGetPredicateWithMoreConstants(Predicate p)
private boolean isBound(Variable key)
private boolean isBoundTo(Variable key, java.lang.Object value)
public java.lang.String toString()
private void addSubstitutions(Variable v1, java.lang.Object o2)
private void addSubstitutions(Variable var1, Variable var2)
private java.lang.Object getSubsConstant(Variable v1)
private SetVector unionSubstitutions(Variable v1, Variable v2)
private SetVector getVariableSubstitutions(Variable v)
private boolean getNewSubstitutions(java.lang.Object o1, java.lang.Object o2)
private boolean getNewSubstitutions(java.lang.Object o2, Variable var1)
private boolean getNewSubstitutions(Variable var1, java.lang.Object o2)
private boolean getNewSubstitutions(Variable var1, Variable var2)
public void clearSubstitutions()
public void clear()
public void makeSubstitutions()
public boolean findSamePredicateSubstitutions(Predicate p1, Predicate p2)
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |