public class OOStateUtilities
extends java.lang.Object
OOState
instances.Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.Object> |
flatStateKeys(OOState s)
Returns all object-variable_key keys.
|
static OOVariableKey |
generateKey(java.lang.Object key)
Generates an
OOVariableKey from a key that is either already an OOVariableKey or a string representation of one. |
static java.lang.Object |
get(OOState s,
java.lang.Object variableKey)
Returns the value of an
ObjectInstance variable, where the key is a OOVariableKey or a string
representation of an OOVariableKey . |
static java.util.List<java.util.List<java.lang.String>> |
getPossibleBindingsGivenParamOrderGroups(OOState s,
java.lang.String[] paramClasses,
java.lang.String[] paramOrderGroups)
Returns all possible object assignments from a
OOState for a given set of parameters that are typed
to OO-MDP object classes. |
static java.util.Set<java.lang.String> |
objectClassesPresent(OOState s)
Returns the set of object classes that have instantiated
ObjectInstance s in the input state. |
static <T extends ObjectInstance> |
objectIndexWithName(java.util.List<T> objects,
java.lang.String name)
Returns the index of an
ObjectInstance with the given name in a list |
static java.lang.String |
objectInstanceToString(ObjectInstance o)
A common approach for turning an
ObjectInstance into a string representation. |
static java.util.Map<java.lang.String,java.util.List<ObjectInstance>> |
objectsByClass(OOState s)
Returns a list of list of
ObjectInstance s where the objects are organized by their class. |
static <T extends ObjectInstance> |
objectWithName(java.util.List<T> objects,
java.lang.String name)
Returns the
ObjectInstance with the given name |
static java.lang.String |
ooStateToString(OOState s)
A common approach for turning an
OOState into a string representation. |
public static <T extends ObjectInstance> T objectWithName(java.util.List<T> objects, java.lang.String name)
ObjectInstance
with the given nameT
- the type of the ObjectInstance
objects
- a list ObjectInstance
sname
- the name of the query ObjectInstance
ObjectInstance
or null if it is not foundpublic static <T extends ObjectInstance> int objectIndexWithName(java.util.List<T> objects, java.lang.String name)
ObjectInstance
with the given name in a listT
- the type of the ObjectInstance
objects
- a list ObjectInstance
sname
- the name of the query ObjectInstance
ObjectInstance
or -1 if it is not foundpublic static java.util.List<java.lang.Object> flatStateKeys(OOState s)
State.variableKeys()
method.s
- the input statepublic static java.lang.Object get(OOState s, java.lang.Object variableKey)
ObjectInstance
variable, where the key is a OOVariableKey
or a string
representation of an OOVariableKey
.s
- the input statevariableKey
- the object-variable keypublic static OOVariableKey generateKey(java.lang.Object key)
OOVariableKey
from a key that is either already an OOVariableKey
or a string representation of one.key
- an OOVariableKey
or a string representation of one.OOVariableKey
public static java.util.Map<java.lang.String,java.util.List<ObjectInstance>> objectsByClass(OOState s)
ObjectInstance
s where the objects are organized by their class.s
- the input OOState
ObjectInstance
s organized by their classpublic static java.util.Set<java.lang.String> objectClassesPresent(OOState s)
ObjectInstance
s in the input state.s
- the input stateObjectInstance
s in the input state.public static java.lang.String ooStateToString(OOState s)
OOState
into a string representation. Useful for implementing
Object.toString()
methods.s
- the input OOState
public static java.lang.String objectInstanceToString(ObjectInstance o)
ObjectInstance
into a string representation. Useful for implementing the
Object.toString()
method.o
- the input ObjectInstance
public static java.util.List<java.util.List<java.lang.String>> getPossibleBindingsGivenParamOrderGroups(OOState s, java.lang.String[] paramClasses, java.lang.String[] paramOrderGroups)
OOState
for a given set of parameters that are typed
to OO-MDP object classes. For example, parameters for a PropositionalFunction
or ObjectParameterizedAction
.s
- the OOState
paramClasses
- the object class type for a parameter array that needs object assignmentsparamOrderGroups
- indicates the order group of a parameter. Parameters in the same
order group can have their object assignments shuffled without affecting the evaluation.
By default, you probably can have a unique order group for each parameters