public class CopyState
extends java.lang.Object
implements jadex.rules.state.IOAVState
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
copy
The state copy.
|
protected jadex.rules.state.IOAVStateListener |
listener
The listener on the original state.
|
protected java.util.List |
listeners
The listeners.
|
protected java.util.Set |
rootobjects
The root objects.
|
protected jadex.rules.state.IOAVState |
state
The original state.
|
protected jadex.commons.concurrent.ISynchronizator |
synchronizator
The synchronizator (e.g.
|
protected jadex.rules.state.OAVTypeModel |
tmodel
The typemodel.
|
Constructor and Description |
---|
CopyState(jadex.rules.state.IOAVState state,
jadex.commons.concurrent.ISynchronizator synchronizator)
Create a local copy state.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttributeValue(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute,
java.lang.Object value)
Add an attribute of an object to the given value.
|
void |
addExternalObjectUsage(java.lang.Object id,
java.lang.Object external)
Add an external usage of a state object.
|
void |
addJavaRootObject(java.lang.Object object)
Add a Java object as root object.
|
void |
addStateListener(jadex.rules.state.IOAVStateListener listener,
boolean bunch)
Add a new state listener.
|
void |
addSubstate(jadex.rules.state.IOAVState substate)
Add a substate.
|
boolean |
containsKey(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute,
java.lang.Object key)
Test if a key is contained in the map attribute.
|
boolean |
containsObject(java.lang.Object object)
Test if the state contains a specific object.
|
protected static java.util.Map |
copyObject(jadex.rules.state.IOAVState state,
java.lang.Object id,
jadex.rules.state.OAVObjectType type)
Copy an OAV object into a map.
|
java.lang.Object |
createObject(jadex.rules.state.OAVObjectType type)
Create an object.
|
java.lang.Object |
createRootObject(jadex.rules.state.OAVObjectType type)
Create a root object.
|
void |
dispose()
Dispose the state.
|
void |
dropObject(java.lang.Object object)
Drop an object from the state.
|
boolean |
equals(java.lang.Object a,
java.lang.Object b)
Test if two values are equal
according to current identity/equality
settings.
|
void |
expungeStaleObjects()
Expunge stale objects.
|
java.util.List |
findCycle(java.util.Collection objects)
Find a cycle in a given set of objects.
|
java.util.Collection |
getAttributeKeys(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute)
Get the keys of an attribute of an object.
|
java.lang.Object |
getAttributeValue(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute)
Get an attribute value of an object.
|
java.lang.Object |
getAttributeValue(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute,
java.lang.Object key)
Get an attribute value of an object.
|
java.util.Collection |
getAttributeValues(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute)
Get the values of an attribute of an object.
|
java.util.Iterator |
getDeepObjects()
Get all objects in the state and its substates.
|
java.util.Iterator |
getObjects()
Get all objects in the state.
|
jadex.rules.state.IProfiler |
getProfiler()
Get the profiler.
|
java.util.Collection |
getReferencingObjects(java.lang.Object value)
Get those objects referencing a given object.
|
java.util.Iterator |
getRootObjects()
Get the root objects of the state.
|
int |
getSize()
Get the number of objects in the state.
|
jadex.rules.state.IOAVState[] |
getSubstates()
Get the substates.
|
jadex.commons.concurrent.ISynchronizator |
getSynchronizator()
Get the synchronizator (if any).
|
jadex.rules.state.OAVObjectType |
getType(java.lang.Object object)
Get the type of an object.
|
jadex.rules.state.OAVTypeModel |
getTypeModel()
Get the type model.
|
java.util.Collection |
getUnreferencedObjects()
Get all unreferenced objects.
|
boolean |
isIdentifier(java.lang.Object object)
Test if the object represents an identifier.
|
boolean |
isJavaIdentity()
Flag indicating that java objects are
stored by identity instead of equality.
|
void |
notifyEventListeners()
Throw collected events and notify the listeners.
|
void |
removeAttributeValue(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute,
java.lang.Object value)
Remove an attribute of an object to the given value.
|
void |
removeExternalObjectUsage(java.lang.Object id,
java.lang.Object external)
Remove an external usage of a state object.
|
void |
removeJavaRootObject(java.lang.Object object)
Remove a Java object from root objects.
|
void |
removeStateListener(jadex.rules.state.IOAVStateListener listener)
Remove a state listener.
|
void |
setAttributeValue(java.lang.Object object,
jadex.rules.state.OAVAttributeType attribute,
java.lang.Object value)
Set an attribute of an object to the given value.
|
void |
setProfiler(jadex.rules.state.IProfiler profiler)
Set the profiler.
|
void |
setSynchronizator(jadex.commons.concurrent.ISynchronizator synchronizator)
Set the synchronizator.
|
protected java.util.Map copy
protected jadex.rules.state.OAVTypeModel tmodel
protected java.util.Set rootobjects
protected jadex.commons.concurrent.ISynchronizator synchronizator
protected jadex.rules.state.IOAVState state
protected jadex.rules.state.IOAVStateListener listener
protected java.util.List listeners
public CopyState(jadex.rules.state.IOAVState state, jadex.commons.concurrent.ISynchronizator synchronizator)
state
- The original state.synchronizator
- The synchronizator used to reflect changes in the copy state.public void dispose()
dispose
in interface jadex.rules.state.IOAVState
protected static java.util.Map copyObject(jadex.rules.state.IOAVState state, java.lang.Object id, jadex.rules.state.OAVObjectType type)
public jadex.rules.state.OAVTypeModel getTypeModel()
getTypeModel
in interface jadex.rules.state.IOAVState
public java.lang.Object createObject(jadex.rules.state.OAVObjectType type)
createObject
in interface jadex.rules.state.IOAVState
type
- The object type (null for defining meta types).public java.lang.Object createRootObject(jadex.rules.state.OAVObjectType type)
createRootObject
in interface jadex.rules.state.IOAVState
public void dropObject(java.lang.Object object)
dropObject
in interface jadex.rules.state.IOAVState
object
- The identifier of the object to remove.public void addJavaRootObject(java.lang.Object object)
addJavaRootObject
in interface jadex.rules.state.IOAVState
object
- The Java object.public void removeJavaRootObject(java.lang.Object object)
removeJavaRootObject
in interface jadex.rules.state.IOAVState
object
- The Java object.public boolean containsObject(java.lang.Object object)
containsObject
in interface jadex.rules.state.IOAVState
object
- The object identifier.public boolean isIdentifier(java.lang.Object object)
isIdentifier
in interface jadex.rules.state.IOAVState
object
- The suspected object identifier.public jadex.rules.state.OAVObjectType getType(java.lang.Object object)
getType
in interface jadex.rules.state.IOAVState
object
- The object identifier.public java.util.Iterator getObjects()
getObjects
in interface jadex.rules.state.IOAVState
public java.util.Iterator getDeepObjects()
getDeepObjects
in interface jadex.rules.state.IOAVState
public java.util.Iterator getRootObjects()
getRootObjects
in interface jadex.rules.state.IOAVState
public int getSize()
getSize
in interface jadex.rules.state.IOAVState
public java.util.Collection getUnreferencedObjects()
getUnreferencedObjects
in interface jadex.rules.state.IOAVState
public java.util.List findCycle(java.util.Collection objects)
findCycle
in interface jadex.rules.state.IOAVState
public java.util.Collection getReferencingObjects(java.lang.Object value)
getReferencingObjects
in interface jadex.rules.state.IOAVState
public void addExternalObjectUsage(java.lang.Object id, java.lang.Object external)
addExternalObjectUsage
in interface jadex.rules.state.IOAVState
id
- The oav object id.external
- The user object.public void removeExternalObjectUsage(java.lang.Object id, java.lang.Object external)
removeExternalObjectUsage
in interface jadex.rules.state.IOAVState
id
- The oav object id.external
- The state external object.public java.lang.Object getAttributeValue(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute)
getAttributeValue
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.public void setAttributeValue(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute, java.lang.Object value)
setAttributeValue
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.value
- The value (basic, object id or java object).public java.util.Collection getAttributeValues(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute)
getAttributeValues
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.public java.util.Collection getAttributeKeys(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute)
getAttributeKeys
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.public java.lang.Object getAttributeValue(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute, java.lang.Object key)
getAttributeValue
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.key
- The key.public boolean containsKey(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute, java.lang.Object key)
containsKey
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.key
- The key.public void addAttributeValue(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute, java.lang.Object value)
addAttributeValue
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.value
- The value (basic, object id or java object).public void removeAttributeValue(java.lang.Object object, jadex.rules.state.OAVAttributeType attribute, java.lang.Object value)
removeAttributeValue
in interface jadex.rules.state.IOAVState
object
- The identifier of the object.attribute
- The attribute identifier.value
- The value (basic, object id or java object).public void addStateListener(jadex.rules.state.IOAVStateListener listener, boolean bunch)
addStateListener
in interface jadex.rules.state.IOAVState
listener
- The state listener.bunch
- True, for adding a bunch listener.public void removeStateListener(jadex.rules.state.IOAVStateListener listener)
removeStateListener
in interface jadex.rules.state.IOAVState
listener
- The state listener.public void notifyEventListeners()
notifyEventListeners
in interface jadex.rules.state.IOAVState
public void expungeStaleObjects()
expungeStaleObjects
in interface jadex.rules.state.IOAVState
public void setSynchronizator(jadex.commons.concurrent.ISynchronizator synchronizator)
setSynchronizator
in interface jadex.rules.state.IOAVState
public jadex.commons.concurrent.ISynchronizator getSynchronizator()
getSynchronizator
in interface jadex.rules.state.IOAVState
public jadex.rules.state.IProfiler getProfiler()
getProfiler
in interface jadex.rules.state.IOAVState
public void setProfiler(jadex.rules.state.IProfiler profiler)
setProfiler
in interface jadex.rules.state.IOAVState
public void addSubstate(jadex.rules.state.IOAVState substate)
addSubstate
in interface jadex.rules.state.IOAVState
public jadex.rules.state.IOAVState[] getSubstates()
getSubstates
in interface jadex.rules.state.IOAVState
public boolean equals(java.lang.Object a, java.lang.Object b)
equals
in interface jadex.rules.state.IOAVState
public boolean isJavaIdentity()
isJavaIdentity
in interface jadex.rules.state.IOAVState