public interface State
variableKeys()
method should return a list of objects that represent the possible keys that are used
to reference state variables in your state. In general, a state variable is any value that when changed alters
the identification of the state. That is, two states with different state variables would not be equal and transition
dynamics and reward functions from them may be different as a result.
get(Object)
method should accept any argument that is listed in the variableKeys()
list
and should return the value of that variable. You do *not* have to guarantee that changes the client makes to the
returned value will affect the state.
copy()
method must be implemented so that a copy of this state can be created.
State copy operations are often performed when generating state transitions, or when a copy of the information
needs to be held by some other data structure. The copy may be a shallow copy
or deep copy and is domain/implementation specific. For clarity, the State implementation may indicate its copy mode with the
DeepCopyState
or ShallowCopyState
annotations. If it is a shallow copy, you should not *directly*
modify any fields of a copied state without copying the fields first, or it could contaminate the state from
which the copy was made. Alternatively, use the MutableState.set(Object, Object)
method to modify
ShallowCopyState
copied states,
which for ShallowCopyState
instances should perform a safe copy-on-write operation.Modifier and Type | Method and Description |
---|---|
State |
copy()
Returns a copy of this state suitable for creating state transitions.
|
java.lang.Object |
get(java.lang.Object variableKey)
Returns the value for the given variable key.
|
java.util.List<java.lang.Object> |
variableKeys()
Returns the list of state variable keys.
|
java.util.List<java.lang.Object> variableKeys()
java.lang.Object get(java.lang.Object variableKey)
variableKey
- the variable keyState copy()
DeepCopyState
or ShallowCopyState
annotations. If it is a shallow copy, you should not *directly*
modify any fields of a copied state without copying the fields first, or it could contaminate the state from
which the copy was made. Alternatively, use the MutableState.set(Object, Object)
method to modify
ShallowCopyState
copied states,
which for ShallowCopyState
instances should perform a safe copy-on-write operation.