Building Parsers with Java

sjm.engine
Class Unification

java.lang.Object
  |
  +--sjm.engine.Unification

public class Unification
extends java.lang.Object

A Unification is a collection of variables. Structures and variables use unifications to keep track of the variable assignments that make a proof work. The unification class itself provides behavior for adding and accessing variables.


Field Summary
static Unification empty
           
 
Constructor Summary
Unification()
          Creates an empty unification.
Unification(Variable v)
          Creates a unification that starts off including a single variable.
 
Method Summary
 Unification addVariable(Variable v)
          Adds a variable to this unification.
 Unification append(Unification u)
          Adds all the variables of another unification to this one.
 java.util.Enumeration elements()
          Return the variables in this unification.
 int size()
          Returns the number of variables in this unification.
 java.lang.String toString()
          Returns a string representation of this unification.
 java.lang.String toStringQuiet()
          Returns a string representation of this unification, without printing variable names.
 void unbind()
          Asks all the contained variables to unbind.
protected  Variable variableAt(int i)
           
protected  java.util.Vector vector()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

empty

public static final Unification empty
Constructor Detail

Unification

public Unification()
Creates an empty unification.

Unification

public Unification(Variable v)
Creates a unification that starts off including a single variable.
Parameters:
Variable - the variable with which the unification begins
Method Detail

addVariable

public Unification addVariable(Variable v)
Adds a variable to this unification.
Parameters:
Variable - the variable to add to this unification
Returns:
this unification

append

public Unification append(Unification u)
Adds all the variables of another unification to this one.
Parameters:
Unification - the unification to append
Returns:
this unification

elements

public java.util.Enumeration elements()
Return the variables in this unification.
Returns:
the variables in this unification.

size

public int size()
Returns the number of variables in this unification.
Returns:
int the number of variables in this unification

toString

public java.lang.String toString()
Returns a string representation of this unification.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this unification

toStringQuiet

public java.lang.String toStringQuiet()
Returns a string representation of this unification, without printing variable names.
Returns:
a string representation of this unification, without printing variable names

unbind

public void unbind()
Asks all the contained variables to unbind.

variableAt

protected Variable variableAt(int i)

vector

protected java.util.Vector vector()

by Steve Metsker