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
ConstructorsModifierConstructorDescriptionprotectedAbstractInstantiatedOperator(Operator other)Creates a new operator from an other.protectedAbstractInstantiatedOperator(String name, int arity)Creates a new operator.protectedAbstractInstantiatedOperator(String name, int[] parameters, int[] instantiations)Creates a new operator. -
Method Summary
Modifier and TypeMethodDescriptionintarity()Returns the arity of the operator.booleanReturnstrueif 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.intgetTypeOfParameters(int index)Returns the type of the parameter at the specified index.intgetValueOfParameter(int index)Returns the value of the parameter at a specified index.inthashCode()Returns a hash code value for this operator.booleanisAlreadyInstantiatedWith(int value)Return if the operator is already instantiated with the specified value.booleanisDummy()Returnstrueif the operator is dummy.voidsetDummy(boolean dummy)Sets the dummy flag of the operator to a specified value.voidSet the name of the operator.voidsetTypeOfParameter(int index, int type)Set a new type the parameter at a specified index.voidsetValueOfParameter(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:
getTypeOfParametersin 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:
setTypeOfParameterin 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:
getValueOfParameterin 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:
setValueOfParameterin 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()Returnstrueif 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:
getParametersin 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:
getInstantiationsin 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:
isAlreadyInstantiatedWithin interfaceOperator- Parameters:
value- the value.- Returns:
trueif the operator is already instantiated with the specified value;falseotherwise.
-
equals
Returnstrueif this operator is equal to an object. This method returnstrueif the object is a not null instance of the classAssignementOperatorand 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.
-