All Packages This Package Class Hierarchy Class Search Index
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();
}
public Bindings getFailure()
Obtains the Failure (representing no consistent
Bindings) object.
- Returns:
- The failure bindings object.
- Implements:
- getFailure in interface Bindings
public static Bindings getEmpty()
Obtains the Empty (representing no current bindings) object.
- Returns:
- The empty bindings object.
public boolean isBound(Variable var)
Determine if the given
Variableis currently bound.
Parameter Description var The variable to check.
- Returns:
- true iff the
Variableis bound.- Implements:
- isBound in interface Bindings
public boolean isEmpty()
Determine if this
HashBindingsobject represents the Empty (no current bindings) object.
- Returns:
- true iff this object is the Empty bindings object.
- Implements:
- isEmpty in interface Bindings
public boolean isFailure()
Determine if this
HashBindingsobject represents the Failure (no consistent bindings) object.
- Returns:
- true iff this object is the Failure bindings object.
- Implements:
- isFailure in interface Bindings
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
public Bindings extendBindings(Variable var,
Object val)
Extends this
HashBindingsobject with an association between the givenVariableand value.Note: This method changes the
HashBindingsobject 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 aBindingsinstance (or part thereof) among many lines of of reasoning. Instead, consider using aListBindingsinstance to manageBindingsfor such applications.
Parameter Description var The variable to bind. val The value to which the Variableis to be bound.
- Returns:
- An extended
HashBindingsobject.- Implements:
- extendBindings in interface Bindings
See Also: ListBindings
public String toString()
Returns a
Stringrepresentation of this object.
- Returns:
- a
Stringrepresentation of this object.- Overrides:
- toString in class Object
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 IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4