standup.unify
Class Unification

java.lang.Object
  extended by standup.unify.Unification

public class Unification
extends Object

A class that provides static methods for performing unification of two Unifiable objects.

Author:
Ruli Manurung

Field Summary
(package private) static int FAIL
           
 
Constructor Summary
Unification()
           
 
Method Summary
static boolean isVariableString(String obj)
           
private static boolean occurCheck(UnifiableVariable v, Unifiable x)
           
static Bindings unify(Unifiable x, Unifiable y)
          Unifies x and y and returns the resulting Bindings.
static Bindings unify(Unifiable x, Unifiable y, Bindings b)
          Unifies x and y using the bindings built so far in b, and returns the resulting Bindings.
private static Bindings unifyVar(UnifiableVariable v, Unifiable x, Bindings b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAIL

static final int FAIL
See Also:
Constant Field Values
Constructor Detail

Unification

public Unification()
Method Detail

unify

public static Bindings unify(Unifiable x,
                             Unifiable y)
Unifies x and y and returns the resulting Bindings. The unification is non-destructive, in the sense that x and y are unmodified. Use Bindings.dereference(Unifiable) to obtain the 'destructively' unified objects.

Parameters:
x - first Unifiable object to be unified
y - second Unifiable object to be unified
Returns:
the resulting Bindings of the unification

unify

public static Bindings unify(Unifiable x,
                             Unifiable y,
                             Bindings b)
Unifies x and y using the bindings built so far in b, and returns the resulting Bindings. The bindings in b are unmodified.

Parameters:
x - first Unifiable object to be unified
y - second Unifiable object to be unified
b - the bindings built so far
Returns:
the resulting Bindings of the unification

unifyVar

private static Bindings unifyVar(UnifiableVariable v,
                                 Unifiable x,
                                 Bindings b)

occurCheck

private static boolean occurCheck(UnifiableVariable v,
                                  Unifiable x)

isVariableString

public static boolean isVariableString(String obj)