Package fr.uga.pddl4j.problem.operator
Class AbstractInstantiatedOperator
java.lang.Object
fr.uga.pddl4j.problem.operator.AbstractInstantiatedOperator
- All Implemented Interfaces:
Operator
,Serializable
- Direct Known Subclasses:
AbstractDurativeOperator
,AbstractIntOperator
,AbstractOperator
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 Summary
ModifierConstructorDescriptionprotected
AbstractInstantiatedOperator(Operator other)
Creates a new operator from an other.protected
AbstractInstantiatedOperator(String name, int arity)
Creates a new operator.protected
AbstractInstantiatedOperator(String name, int[] parameters, int[] instantiations)
Creates a new operator. -
Method Summary
Modifier and TypeMethodDescriptionint
arity()
Returns the arity of the operator.boolean
Returnstrue
if this operator is equal to an object.int[]
Returns the values that represents the instantiated parameters of the operator.getName()
Return the name of this operator.int[]
Returns the list of parameters of the operator.int
getTypeOfParameters(int index)
Returns the type of the parameter at the specified index.int
getValueOfParameter(int index)
Returns the value of the parameter at a specified index.int
hashCode()
Returns a hash code value for this operator.boolean
isAlreadyInstantiatedWith(int value)
Return if the operator is already instantiated with the specified value.boolean
isDummy()
Returnstrue
if the operator is dummy.void
setDummy(boolean dummy)
Sets the dummy flag of the operator to a specified value.void
Set the name of the operator.void
setTypeOfParameter(int index, int type)
Set a new type the parameter at a specified index.void
setValueOfParameter(int index, int value)
Instantiate a parameter of the operator at a specified index with a value.
-
Constructor Details
-
AbstractInstantiatedOperator
Creates a new operator from an other.- Parameters:
other
- the other operator.
-
AbstractInstantiatedOperator
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
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
Return the name of this operator. -
setName
Set the name of the operator. -
getTypeOfParameters
public final int getTypeOfParameters(int index)Returns the type of the parameter at the specified index.- Specified by:
getTypeOfParameters
in interfaceOperator
- 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 interfaceOperator
- 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 interfaceOperator
- 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 interfaceOperator
- 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. -
isDummy
public final boolean isDummy()Returnstrue
if the operator is dummy. -
setDummy
public final void setDummy(boolean dummy)Sets the dummy flag of the operator to a specified value. -
getParameters
public final int[] getParameters()Returns the list of parameters of the operator.- Specified by:
getParameters
in interfaceOperator
- 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 interfaceOperator
- 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 interfaceOperator
- Parameters:
value
- the value.- Returns:
true
if the operator is already instantiated with the specified value;false
otherwise.
-
equals
Returnstrue
if this operator is equal to an object. This method returnstrue
if the object is a not null instance of the classAssignementOperator
and both operator have the same name. -
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 byjava.util.Hashtable
.
-