com.sri.oaa2.icl
Class Unifier

java.lang.Object
  |
  +--com.sri.oaa2.icl.Unifier
Direct Known Subclasses:
IclObjectUnificator

public class Unifier
extends java.lang.Object

Object based unification class and methods.


Constructor Summary
Unifier()
           
 
Method Summary
 IclTerm deref(IclTerm t, java.util.HashMap bindings)
          Creates a copy of the term.
static Unifier getInstance()
          Get an instance of a Unifier.
 boolean matchTerms(IclTerm t1, IclTerm t2, java.util.HashMap bindings)
          Tests for term matching, matches, and binds variables.
 IclTerm unify(IclTerm t1, IclTerm t2)
          Unifies two terms.
 IclTerm unify(IclTerm t1, IclTerm t2, java.util.HashMap bindings)
          Unifies two terms using the given variable bindings.
 IclTerm unifyDebug(IclTerm t1, IclTerm t2)
          Unifies two terms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Unifier

public Unifier()
Method Detail

getInstance

public static final Unifier getInstance()
Get an instance of a Unifier.


unify

public final IclTerm unify(IclTerm t1,
                           IclTerm t2)
Unifies two terms.

Parameters:
t1 - the first term
t2 - the second term
Returns:
null if unification fails, and the term resulting from the unification if success

unifyDebug

public final IclTerm unifyDebug(IclTerm t1,
                                IclTerm t2)
Unifies two terms.

Parameters:
t1 - the first term
t2 - the second term
Returns:
null if unification fails, and the term resulting from the unification if success

unify

public final IclTerm unify(IclTerm t1,
                           IclTerm t2,
                           java.util.HashMap bindings)
Unifies two terms using the given variable bindings.

Parameters:
t1 - the first term
t2 - the second term
bindings - the bindings to use
Returns:
null if unification fails, and a the term resulting from the unification if success

matchTerms

public final boolean matchTerms(IclTerm t1,
                                IclTerm t2,
                                java.util.HashMap bindings)
Tests for term matching, matches, and binds variables.

Parameters:
t1 - first term
t2 - second term
bindings - variable bindings to use
Returns:
true if Term1 matches Term2, saving variable bindings as it goes

deref

public final IclTerm deref(IclTerm t,
                           java.util.HashMap bindings)
Creates a copy of the term. Dereferences variables from binding list, if available.

Parameters:
t - a term to dereference
Returns:
Term with all variables instantiated according to bindings. This is a new IclTerm, not the same as t.