Class WriteableObjectPoolImpl<T extends DataObject>
java.lang.Object
de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
de.uni_trier.wi2.procake.data.objectpool.impl.WriteableObjectPoolImpl<T>
- All Implemented Interfaces:
ObjectPoolFactoryImplementation
,ReadableObjectPool<T>
,WriteableObjectPool<T>
,Iterable<T>
public class WriteableObjectPoolImpl<T extends DataObject>
extends FactoryObjectImplementation
implements WriteableObjectPool<T>
- Author:
- Rainer Maximini
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
getId()
Each Pool must have an id.getObjectIds
(DataClass dataClass) boolean
hasSameValueAsIn
(ReadableObjectPool objectPool) This method makes a deep compare.iterator()
newObjectId
(String base, String offset) void
postInit()
Called after all factories are initialized withFactoryObjectImplementation.preInit(AbstractParameter[])
and bind to the factory.void
preInit
(AbstractParameter[] parameter) Called directly after creating the implementation.Removes the object with the given offset from the pool.Removes the given data object from the pool.void
Removes all items from the poolboolean
void
Each Pool must have an id.int
size()
void
sort
(Comparator<T> comparator) Sorts the objects in pool using the given comparator.Stores a givenDataObject
into the pool.storeAll
(ReadableObjectPool<T> objects) storeAll
(Collection<T> objects) stream()
This method is a short call for supplying a stream access to the graphs in the pool.toXML()
Converts object pool to XMLMethods inherited from class de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
getParameter, initParametersBasedOn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
WriteableObjectPoolImpl
public WriteableObjectPoolImpl()
-
-
Method Details
-
setId
Description copied from interface:ReadableObjectPool
Each Pool must have an id. This Id is used as base in objectId.- Specified by:
setId
in interfaceReadableObjectPool<T extends DataObject>
-
getId
Description copied from interface:ReadableObjectPool
Each Pool must have an id. This Id is used as base in objectId.- Specified by:
getId
in interfaceReadableObjectPool<T extends DataObject>
-
getObject
- Specified by:
getObject
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- The object with the given id.
-
getObjectIds
- Specified by:
getObjectIds
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- The set of all object ids.
-
getObjectIds
- Specified by:
getObjectIds
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- A set of the object ids for the specified data class.
-
getParameters
- Specified by:
getParameters
in classFactoryObjectImplementation
- Returns:
- Returns a list of available parameters in the implementation. This method can be called
without initialization and is never
null
.
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends DataObject>
- Specified by:
iterator
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- An iterator over all
DataObject
s.
-
newObjectId
- Specified by:
newObjectId
in interfaceObjectPoolFactoryImplementation
-
postInit
public void postInit()Description copied from class:FactoryObjectImplementation
Called after all factories are initialized withFactoryObjectImplementation.preInit(AbstractParameter[])
and bind to the factory.- Specified by:
postInit
in classFactoryObjectImplementation
-
preInit
Description copied from class:FactoryObjectImplementation
Called directly after creating the implementation.- Specified by:
preInit
in classFactoryObjectImplementation
- Parameters:
parameter
- The parameters to initialize the implementation.
-
remove
Description copied from interface:WriteableObjectPool
Removes the given data object from the pool. The objectId of the removed object should be automatically removed from the object.- Specified by:
remove
in interfaceWriteableObjectPool<T extends DataObject>
- Parameters:
object
- The object to remove- Returns:
- The removed object or
null
if the object was not in the pool.
-
remove
Description copied from interface:WriteableObjectPool
Removes the object with the given offset from the pool. The objectId of the removed object should be automatically removed from the object.- Specified by:
remove
in interfaceWriteableObjectPool<T extends DataObject>
- Parameters:
objectId
- The offset of the object that should be removed.- Returns:
- The removed object or
null
if the object was not in the pool.
-
size
public int size()- Specified by:
size
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- The number of
DataObject
s in the pool.
-
store
Description copied from interface:WriteableObjectPool
Stores a givenDataObject
into the pool. Thereby, a new unique objectI id is automatically created. If the object is already a member of the pool, nothing will happen.- Specified by:
store
in interfaceWriteableObjectPool<T extends DataObject>
- Parameters:
object
- The object that should be added.- Returns:
- The new objectId of the added object.
-
storeAll
- Specified by:
storeAll
in interfaceWriteableObjectPool<T extends DataObject>
- Returns:
-
storeAll
- Specified by:
storeAll
in interfaceWriteableObjectPool<T extends DataObject>
- Returns:
-
removeAll
public void removeAll()Description copied from interface:WriteableObjectPool
Removes all items from the pool- Specified by:
removeAll
in interfaceWriteableObjectPool<T extends DataObject>
-
removeIf
- Specified by:
removeIf
in interfaceWriteableObjectPool<T extends DataObject>
- Parameters:
filter
- to remove corresponding items from the pool- Returns:
- whether items have been removed
-
getNESTGraphIds
- Specified by:
getNESTGraphIds
in interfaceReadableObjectPool<T extends DataObject>
-
getNESTGraphObjectsRecursively
- Specified by:
getNESTGraphObjectsRecursively
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- A set of all
NESTWorkflowObject
s in the pool, no matter how deeply nested.
-
copy
- Specified by:
copy
in interfaceWriteableObjectPool<T extends DataObject>
- Returns:
- deep copy of the pool
-
toXML
Description copied from interface:ReadableObjectPool
Converts object pool to XML- Specified by:
toXML
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- XML String
-
getCollection
- Specified by:
getCollection
in interfaceReadableObjectPool<T extends DataObject>
-
sort
Description copied from interface:WriteableObjectPool
Sorts the objects in pool using the given comparator.- Specified by:
sort
in interfaceWriteableObjectPool<T extends DataObject>
-
hasSameValueAsIn
Description copied from interface:ReadableObjectPool
This method makes a deep compare. The elements in both pools are compared.- Specified by:
hasSameValueAsIn
in interfaceReadableObjectPool<T extends DataObject>
- Parameters:
objectPool
- The object pool to compare.- Returns:
true
if the givenobject pool
has the same objects as this one.
-
stream
Description copied from interface:ReadableObjectPool
This method is a short call for supplying a stream access to the graphs in the pool.- Specified by:
stream
in interfaceReadableObjectPool<T extends DataObject>
- Returns:
- a stream of the pool objects
-