JSHOP2
Class DomainElement

java.lang.Object
  extended by JSHOP2.DomainElement
Direct Known Subclasses:
Axiom, Method, Operator

public abstract class DomainElement
extends java.lang.Object

This abstract class implements the basic common functionality of the all possible elements (i.e., methods, operators, and axioms) of a domain at run time.

Version:
1.0.3
Author:
Okhtay Ilghami, http://www.cs.umd.edu/~okhtay

Field Summary
private  Predicate head
          Every element has a head, which is a predicate.
 
Constructor Summary
DomainElement(Predicate headIn)
          To initialize the domain element.
 
Method Summary
 Predicate getHead()
          This function returns the head of this domain element.
abstract  Precondition getIterator(Term[] binding, int which)
          This abstract function returns a handle that can be used to calculate, one by one, the bindings that satisfy the precondition of this domain element in a given state of the world with respect to a given binding.
 Term[] unify(Predicate p)
          This function returns the substitution that unifies the head of this element with a given predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

private Predicate head
Every element has a head, which is a predicate.

Constructor Detail

DomainElement

public DomainElement(Predicate headIn)
To initialize the domain element.

Parameters:
headIn - head of the domain element.
Method Detail

getHead

public Predicate getHead()
This function returns the head of this domain element.

Returns:
the head of this element, which is a predicate.

getIterator

public abstract Precondition getIterator(Term[] binding,
                                         int which)
This abstract function returns a handle that can be used to calculate, one by one, the bindings that satisfy the precondition of this domain element in a given state of the world with respect to a given binding.

Parameters:
binding - current binding.
which - which precondition to use (ignored if this element is an operator, since operators have only one precondition).
Returns:
an object of type Precondition which can be used later on to get the bindings one by one.

unify

public Term[] unify(Predicate p)
This function returns the substitution that unifies the head of this element with a given predicate.

Parameters:
p - input predicate
Returns:
an array that shows with what each variable should be substituted.