package aima.logic;
/**
* The Bindings interface is the basis for associating individual
* Variable
s with arbitrary JAVA Object
values.
*
*
* It is expected that in addition to the dynamic methods required by
* this interface, each implementation will also define a static
* method getEmpty()
which will return a unique object
* representing a Bindings
instance that contains no
* actual Variable
bindings.
*
* @author Michael S. Braverman
* @see Variable
*/
public interface Bindings {
/**
* Obtains the Failure (representing no consistent Bindings
)
* object.
*
* @return The failure bindings object.
*
*/
public Bindings getFailure();
/**
* Determine if this Bindings
object represents the
* Failure (no consistent bindings) object.
*
* @return true iff this object is the Failure bindings object.
*/
public boolean isFailure();
/**
* Determine if this Bindings
object represents the
* Empty (no current bindings) object.
*
*
* It is expected that all implementations of the Bindings
* interface will provide a static method getEmpty()
which
* will return a unique (to the particular implementation) object
* representing a Bindings
instance that contains no actual
* Variable
bindings.
* This isEmpty
predicate is intended to test for that
* unique (to the implementation) object.
*
* @return true iff this object is the Empty bindings object.
*/
public boolean isEmpty();
/**
* Determine if the given Variable
is currently bound.
*
* @return true iff the Variable
is bound.
* @param var The variable to check.
*/
public boolean isBound(Variable var);
/**
* Get the current binding of the given Variable
.
*
* @return The value associated with the variable.
* @param var The variable to look up.
*/
public Object getBinding(Variable var);
/**
* Extends this Bindings
object with an association between
* the given Variable
and value.
*
*
* Note:
* A particular implementation is allowed, though not required, to change
* the Bindings
object on which it is invoked if the variable
* is already bound in the Bindings
object.
*
* @return An extended Bindings
object.
* @param var The variable to bind.
* @param val The value to which the Variable
is to be bound.
*/
public Bindings extendBindings (Variable var, Object val);
}