Class AbstractInstantiatedOperator

java.lang.Object
fr.uga.pddl4j.problem.operator.AbstractInstantiatedOperator
All Implemented Interfaces:
Operator, Serializable
Direct Known Subclasses:
AbstractDurativeOperator, AbstractIntOperator, AbstractOperator

public abstract class AbstractInstantiatedOperator extends Object implements Operator
This abstract class implements the common part of an ground operator (action or method) what ever its representation, i.e., integer or bit set.
See Also:
Serialized Form
  • Constructor Details

    • AbstractInstantiatedOperator

      protected AbstractInstantiatedOperator(Operator other)
      Creates a new operator from an other.
      Parameters:
      other - the other operator.
    • AbstractInstantiatedOperator

      protected AbstractInstantiatedOperator(String name, int arity)
      Creates a new operator. The parameters and instantiation are initialized with 0.
      Parameters:
      name - the name of the operator.
      arity - the arity of the operator.
    • AbstractInstantiatedOperator

      protected AbstractInstantiatedOperator(String name, int[] parameters, int[] instantiations)
      Creates a new operator. The length of the parameters and the length of instantiations must be the same.
      Parameters:
      name - the name of the operator.
      parameters - the types of the parameters.
      instantiations - the values of the parameters.
  • Method Details

    • getName

      public final String getName()
      Return the name of this operator.
      Specified by:
      getName in interface Operator
      Returns:
      the name of this operator
    • setName

      public final void setName(String name)
      Set the name of the operator.
      Specified by:
      setName in interface Operator
      Parameters:
      name - the name to set.
    • getTypeOfParameters

      public final int getTypeOfParameters(int index)
      Returns the type of the parameter at the specified index.
      Specified by:
      getTypeOfParameters in interface Operator
      Parameters:
      index - the index of the parameter.
      Returns:
      the type of the parameter at the specified index.
    • setTypeOfParameter

      public final void setTypeOfParameter(int index, int type)
      Set a new type the parameter at a specified index.
      Specified by:
      setTypeOfParameter in interface Operator
      Parameters:
      index - the index of the parameter. The index must be in [0,arity[.
      type - the type to set.
    • getValueOfParameter

      public final int getValueOfParameter(int index)
      Returns the value of the parameter at a specified index.
      Specified by:
      getValueOfParameter in interface Operator
      Parameters:
      index - the index. The index must be in [0,arity[.
      Returns:
      the value of the parameter.
    • setValueOfParameter

      public final void setValueOfParameter(int index, int value)
      Instantiate a parameter of the operator at a specified index with a value.

      The assumption is made that different operator parameters are instantiated with different constants, i.e., the planner never generates actions like move(a,a) because we consider this as a bad domain representation that should be revised. In fact, in actions with identical constant parameters, all but one of the constants are superfluous and can be skipped from the representation without loss of information.

      Specified by:
      setValueOfParameter in interface Operator
      Parameters:
      index - the index of the parameter to instantiate. The index must be in [0,arity[.
      value - the value of instantiation.
    • arity

      public final int arity()
      Returns the arity of the operator.
      Specified by:
      arity in interface Operator
      Returns:
      the arity of the operator.
    • isDummy

      public final boolean isDummy()
      Returns true if the operator is dummy.
      Specified by:
      isDummy in interface Operator
      Returns:
      true if the operator is dummy; false otherwise.
    • setDummy

      public final void setDummy(boolean dummy)
      Sets the dummy flag of the operator to a specified value.
      Specified by:
      setDummy in interface Operator
      Parameters:
      dummy - the value of the dummy flag of the operator to set.
    • getParameters

      public final int[] getParameters()
      Returns the list of parameters of the operator.
      Specified by:
      getParameters in interface Operator
      Returns:
      the list of parameters of the operator.
    • getInstantiations

      public int[] getInstantiations()
      Returns the values that represents the instantiated parameters of the operator.
      Specified by:
      getInstantiations in interface Operator
      Returns:
      the values that represents the instantiated parameters of the operator.
    • isAlreadyInstantiatedWith

      public final boolean isAlreadyInstantiatedWith(int value)
      Return if the operator is already instantiated with the specified value.
      Specified by:
      isAlreadyInstantiatedWith in interface Operator
      Parameters:
      value - the value.
      Returns:
      true if the operator is already instantiated with the specified value; false otherwise.
    • equals

      public final boolean equals(Object obj)
      Returns true if this operator is equal to an object. This method returns true if the object is a not null instance of the class AssignementOperator and both operator have the same name.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to be compared.
      Returns:
      true if this operator is equal to an object; false otherwise.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this operator. This method is supported for the benefit of hash tables such as those provided by java.util.Hashtable.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this operator.