All Packages  This Package  Class Hierarchy  Class Search  Index

Class aima.logic.HashBindings

java.lang.Object
   |
   +----aima.logic.HashBindings

The HashBindings class implements the Bindings interface using a Hashtable.

Note: This implementation may not be appropriate for the various theorem provers which need an implementation of Bindings that allow bindings to be cheaply extended in several different directions. For that, consider using ListBindings.

See Also: ListBindings


public class  HashBindings
     extends java.lang.Object
     implements aima.logic.Bindings
{
          // Methods 9
     public Bindings extendBindings(Variable, Object);
     public Object getBinding(Variable);
     public static Bindings getEmpty();
     public Bindings getFailure();
     public boolean isBound(Variable);
     public boolean isEmpty();
     public boolean isFailure();
     public static void main(String[]);
     public String toString();
}



Methods


getFailure

   public Bindings getFailure() 

Obtains the Failure (representing no consistent Bindings) object.

Returns:
The failure bindings object.
Implements:
getFailure in interface Bindings


getEmpty

   public static Bindings getEmpty() 

Obtains the Empty (representing no current bindings) object.

Returns:
The empty bindings object.


isBound

   public boolean isBound(Variable var) 

Determine if the given Variable is currently bound.

Parameter Description
var The variable to check.

Returns:
true iff the Variable is bound.
Implements:
isBound in interface Bindings


isEmpty

   public boolean isEmpty() 

Determine if this HashBindings object represents the Empty (no current bindings) object.

Returns:
true iff this object is the Empty bindings object.
Implements:
isEmpty in interface Bindings


isFailure

   public boolean isFailure() 

Determine if this HashBindings object represents the Failure (no consistent bindings) object.

Returns:
true iff this object is the Failure bindings object.
Implements:
isFailure in interface Bindings


getBinding

   public Object getBinding(Variable var) 

Get the current binding of the given Variable.

Parameter Description
var The variable to look up.

Returns:
The value associated with the variable.
Implements:
getBinding in interface Bindings


extendBindings

   public Bindings extendBindings(Variable var, 
                                  Object val) 

Extends this HashBindings object with an association between the given Variable and value.

Note: This method changes the HashBindings object on which it is invoked. This is fine, and efficient, for simple unification applications, but will not work well for the various theorem provers which may want to share a Bindings instance (or part thereof) among many lines of of reasoning. Instead, consider using a ListBindings instance to manage Bindings for such applications.

Parameter Description
var The variable to bind.
val The value to which the Variable is to be bound.

Returns:
An extended HashBindings object.
Implements:
extendBindings in interface Bindings

See Also: ListBindings



toString

   public String toString() 

Returns a String representation of this object.

Returns:
a String representation of this object.
Overrides:
toString in class Object


main

   public static void main(String[] args) 

Tests out the functionality of this class.

Parameter Description
args Ignored.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4