Package jadex.rules.state.javaimpl
Class OAVMixedWeakState
- java.lang.Object
-
- jadex.rules.state.javaimpl.OAVAbstractState
-
- jadex.rules.state.javaimpl.OAVMixedWeakState
-
- All Implemented Interfaces:
IOAVState
public class OAVMixedWeakState extends OAVAbstractState
An object holding the state as OAV triples (object, attribute, value).
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map
objects
The objects table (oid -> content map).protected java.util.Map
weakobjects
The weak objects (object id -> content map).-
Fields inherited from class jadex.rules.state.javaimpl.OAVAbstractState
beanlistenercnt, deletedobjects, eventhandler, generator, javaidentity, javaobjects, nocheck, objectusages, PCL, pcls, profiler, rootobjects, substates, synchronizator, tmodel, TYPE
-
-
Constructor Summary
Constructors Constructor Description OAVMixedWeakState(OAVTypeModel tmodel)
Create a new empty OAV state representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExternalObjectUsage(java.lang.Object id, java.lang.Object external)
Add an external usage of a state object (oid).protected boolean
checkValidStateObjectRead(java.lang.Object id)
Test if reading the object (oid) is allowed.protected java.util.Map
getObject0(java.lang.Object id)
Get an object map for its id.protected boolean
internalContainsObject(java.lang.Object id)
Test if an object is contained in the state.protected java.util.Map
internalCreateObject(java.lang.Object id)
Internally create an object.protected java.util.Map
internalGetObjectContent(java.lang.Object id)
Get the object content of an object.protected java.util.Set
internalGetObjects()
Get a set of the internal state objects.protected int
internalObjectsSize()
Test how many object are contained in the state.protected java.util.Map
internalRemoveObject(java.lang.Object id)
Remove an object from the state objects.protected boolean
isExternallyUsed(java.lang.Object id)
Test if an object is externally used.void
removeExternalObjectUsage(java.lang.Object id, java.lang.Object external)
Remove an external usage of a state object (oid).protected void
removeObject(java.lang.Object id)
Ultimately remove an object (oid), when there are no more external or internal references.-
Methods inherited from class jadex.rules.state.javaimpl.OAVAbstractState
addAttributeValue, addJavaRootObject, addObjectUsage, addStateListener, addSubstate, checkMultiplicity, checkMultiplicity, checkTypeDefined, checkTypeHasAttribute, checkValidStateObject, checkValidStateValue, checkValueCompatibility, containsKey, containsObject, createIdGenerator, createObject, createObject, createRootObject, deregisterValue, dispose, dropObject, equals, expungeStaleObjects, findCycle, findCycleForValue, getAttributeKeys, getAttributeValue, getAttributeValue, getAttributeValues, getDeepObjects, getObject, getObjects, getObjectUsages, getProfiler, getReferencingObjects, getRootObjects, getSize, getSubstates, getSynchronizator, getType, getTypeModel, getUnreferencedObjects, internalDropObject, isIdentifier, isJavaIdentity, isManaged, isReachable, notifyEventListeners, registerValue, removeAttributeValue, removeJavaRootObject, removeObjectUsage, removeStateListener, setAttributeValue, setProfiler, setSynchronizator, toString
-
-
-
-
Constructor Detail
-
OAVMixedWeakState
public OAVMixedWeakState(OAVTypeModel tmodel)
Create a new empty OAV state representation.
-
-
Method Detail
-
removeObject
protected void removeObject(java.lang.Object id)
Ultimately remove an object (oid), when there are no more external or internal references.- Overrides:
removeObject
in classOAVAbstractState
-
addExternalObjectUsage
public void addExternalObjectUsage(java.lang.Object id, java.lang.Object external)
Add an external usage of a state object (oid). This prevents the oav object of being garbage collected as long as external references are present.- Specified by:
addExternalObjectUsage
in interfaceIOAVState
- Specified by:
addExternalObjectUsage
in classOAVAbstractState
- Parameters:
id
- The oav object id.external
- The user object.
-
removeExternalObjectUsage
public void removeExternalObjectUsage(java.lang.Object id, java.lang.Object external)
Remove an external usage of a state object (oid). This allows the oav object of being garbage collected when no further external references and no internal references are present.- Specified by:
removeExternalObjectUsage
in interfaceIOAVState
- Specified by:
removeExternalObjectUsage
in classOAVAbstractState
- Parameters:
id
- The oav object id.external
- The state external object.
-
isExternallyUsed
protected boolean isExternallyUsed(java.lang.Object id)
Test if an object is externally used.- Specified by:
isExternallyUsed
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- True, if externally used.
-
getObject0
protected java.util.Map getObject0(java.lang.Object id)
Get an object map for its id.- Overrides:
getObject0
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- The object map.
-
checkValidStateObjectRead
protected boolean checkValidStateObjectRead(java.lang.Object id)
Test if reading the object (oid) is allowed. Reading is allowed on removed objects as long as there are external references.- Overrides:
checkValidStateObjectRead
in classOAVAbstractState
- Parameters:
id
- The object (oid).- Returns:
- True, if valid.
-
internalCreateObject
protected java.util.Map internalCreateObject(java.lang.Object id)
Internally create an object.- Specified by:
internalCreateObject
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- The content map of the new object.
-
internalRemoveObject
protected java.util.Map internalRemoveObject(java.lang.Object id)
Remove an object from the state objects.- Specified by:
internalRemoveObject
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- The content map of the object.
-
internalGetObjectContent
protected java.util.Map internalGetObjectContent(java.lang.Object id)
Get the object content of an object.- Specified by:
internalGetObjectContent
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- The content map of the object.
-
internalContainsObject
protected boolean internalContainsObject(java.lang.Object id)
Test if an object is contained in the state.- Specified by:
internalContainsObject
in classOAVAbstractState
- Parameters:
id
- The id.- Returns:
- True, if object is contained.
-
internalObjectsSize
protected int internalObjectsSize()
Test how many object are contained in the state.- Specified by:
internalObjectsSize
in classOAVAbstractState
- Returns:
- The number of objects.
-
internalGetObjects
protected java.util.Set internalGetObjects()
Get a set of the internal state objects.- Specified by:
internalGetObjects
in classOAVAbstractState
- Returns:
- A set of the state objects.
-
-