public class DeepOOState extends GenericOOState
GenericOOState
in which the copy()
operations performs a deep copy
(DeepCopyState
) of all ObjectInstance
objects, thereby allows safe modification of any of its
ObjectInstance
objects without using the GenericOOState.touch(String)
method. As a result, this implementation
will cause greater memory overhead in your algorithms, but requires less management on a client that is manipulating
the states (e.g., defining transition dynamics).objectsByClass, objectsMap
Constructor and Description |
---|
DeepOOState() |
DeepOOState(ObjectInstance... objects) |
DeepOOState(OOState srcOOState) |
Modifier and Type | Method and Description |
---|---|
DeepOOState |
copy()
Returns a copy of this state suitable for creating state transitions.
|
MutableState |
set(java.lang.Object variableKey,
java.lang.Object value)
Sets the value for the given variable key.
|
addObject, get, getObjectsByClass, getObjectsMap, getOrGenerateObjectClassList, numObjects, object, objects, objectsOfClass, removeObject, renameObject, setObjectsByClass, setObjectsMap, toString, touch, variableKeys
public DeepOOState()
public DeepOOState(OOState srcOOState)
public DeepOOState(ObjectInstance... objects)
public MutableState set(java.lang.Object variableKey, java.lang.Object value)
MutableState
set
in interface MutableState
set
in class GenericOOState
variableKey
- the key identifier for the variable value to changevalue
- the variable value to which the variable should be set.public DeepOOState copy()
State
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.copy
in interface State
copy
in class GenericOOState