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
Constructors Constructor Description WriteableObjectPoolImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WriteableObjectPool<T>copy()Collection<T>getCollection()StringgetId()Each Pool must have an Id.Set<String>getNESTGraphIds()Set<NESTWorkflowObject>getNESTGraphObjectsRecursively()TgetObject(String objectId)Set<String>getObjectIds()Set<String>getObjectIds(DataClass dataClass)List<Parameter>getParameters()booleanhasSameValueAsIn(ReadableObjectPool objectPool)This method makes a deep compare.DataObjectIterator<T>iterator()StringnewObjectId(String base, String offset)voidpostInit()Called after all factories are initialized withFactoryObjectImplementation.preInit(AbstractParameter[])and bind to the factory.voidpreInit(AbstractParameter[] parameter)Called directly after creating the implementation.Tremove(String objectId)Removes the object with the given offset from the pool.Tremove(T object)Removes the given data object from the pool.voidremoveAll()Removes all items from the poolintsize()voidsort(Comparator<T> comparator)Sorts the objects in pool using the given comparator.Stringstore(T object)Stores a givenDataObjectinto the pool.Set<String>storeAll(ReadableObjectPool<T> objects)Set<String>storeAll(Collection<T> objects)Stream<T>stream()This method is a short call for supplying a stream access to the graphs in the pool.StringtoXML()Converts object pool to XML-
Methods 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
-
-
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:ReadableObjectPoolEach Pool must have an Id. This Id is used as base in objectId.- Specified by:
getIdin interfaceReadableObjectPool<T extends DataObject>
-
getObject
public T getObject(String objectId)
- Specified by:
getObjectin interfaceReadableObjectPool<T extends DataObject>- Returns:
- The object with the given id.
-
getObjectIds
public Set<String> getObjectIds()
- Specified by:
getObjectIdsin interfaceReadableObjectPool<T extends DataObject>- Returns:
- The set of all object ids.
-
getObjectIds
public Set<String> getObjectIds(DataClass dataClass)
- Specified by:
getObjectIdsin interfaceReadableObjectPool<T extends DataObject>- Returns:
- A set of the object ids for the specified data class.
-
getParameters
public List<Parameter> getParameters()
- Specified by:
getParametersin classFactoryObjectImplementation- Returns:
- Returns a list of available parameters in the implementation. This method can be called
without initialization and is never
null.
-
iterator
public DataObjectIterator<T> iterator()
- Specified by:
iteratorin interfaceIterable<T extends DataObject>- Specified by:
iteratorin interfaceReadableObjectPool<T extends DataObject>- Returns:
- An iterator over all
DataObjects.
-
newObjectId
public String newObjectId(String base, String offset)
- Specified by:
newObjectIdin interfaceObjectPoolFactoryImplementation
-
postInit
public void postInit()
Description copied from class:FactoryObjectImplementationCalled after all factories are initialized withFactoryObjectImplementation.preInit(AbstractParameter[])and bind to the factory.- Specified by:
postInitin classFactoryObjectImplementation
-
preInit
public void preInit(AbstractParameter[] parameter)
Description copied from class:FactoryObjectImplementationCalled directly after creating the implementation.- Specified by:
preInitin classFactoryObjectImplementation- Parameters:
parameter- The parameters to initialize the implementation.
-
remove
public T remove(T object)
Description copied from interface:WriteableObjectPoolRemoves the given data object from the pool. The objectId of the removed object should be automatically removed from the object.- Specified by:
removein interfaceWriteableObjectPool<T extends DataObject>- Parameters:
object- The object to remove- Returns:
- The removed object or
nullif the object was not in the pool.
-
remove
public T remove(String objectId)
Description copied from interface:WriteableObjectPoolRemoves the object with the given offset from the pool. The objectId of the removed object should be automatically removed from the object.- Specified by:
removein interfaceWriteableObjectPool<T extends DataObject>- Parameters:
objectId- The offset of the object that should be removed.- Returns:
- The removed object or
nullif the object was not in the pool.
-
size
public int size()
- Specified by:
sizein interfaceReadableObjectPool<T extends DataObject>- Returns:
- The number of
DataObjects in the pool.
-
store
public String store(T object)
Description copied from interface:WriteableObjectPoolStores a givenDataObjectinto 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:
storein interfaceWriteableObjectPool<T extends DataObject>- Parameters:
object- The object that should be added.- Returns:
- The new objectId of the added object.
-
storeAll
public Set<String> storeAll(Collection<T> objects)
- Specified by:
storeAllin interfaceWriteableObjectPool<T extends DataObject>- Returns:
-
storeAll
public Set<String> storeAll(ReadableObjectPool<T> objects)
- Specified by:
storeAllin interfaceWriteableObjectPool<T extends DataObject>- Returns:
-
removeAll
public void removeAll()
Description copied from interface:WriteableObjectPoolRemoves all items from the pool- Specified by:
removeAllin interfaceWriteableObjectPool<T extends DataObject>
-
getNESTGraphIds
public Set<String> getNESTGraphIds()
- Specified by:
getNESTGraphIdsin interfaceReadableObjectPool<T extends DataObject>
-
getNESTGraphObjectsRecursively
public Set<NESTWorkflowObject> getNESTGraphObjectsRecursively()
- Specified by:
getNESTGraphObjectsRecursivelyin interfaceReadableObjectPool<T extends DataObject>- Returns:
- A set of all
NESTWorkflowObjects in the pool, no matter how deeply nested.
-
copy
public WriteableObjectPool<T> copy()
- Specified by:
copyin interfaceWriteableObjectPool<T extends DataObject>- Returns:
- deep copy of the pool
-
toXML
public String toXML()
Description copied from interface:ReadableObjectPoolConverts object pool to XML- Specified by:
toXMLin interfaceReadableObjectPool<T extends DataObject>- Returns:
- XML String
-
getCollection
public Collection<T> getCollection()
- Specified by:
getCollectionin interfaceReadableObjectPool<T extends DataObject>
-
sort
public void sort(Comparator<T> comparator)
Description copied from interface:WriteableObjectPoolSorts the objects in pool using the given comparator.- Specified by:
sortin interfaceWriteableObjectPool<T extends DataObject>
-
hasSameValueAsIn
public boolean hasSameValueAsIn(ReadableObjectPool objectPool)
Description copied from interface:ReadableObjectPoolThis method makes a deep compare. The elements in both pools are compared.- Specified by:
hasSameValueAsInin interfaceReadableObjectPool<T extends DataObject>- Parameters:
objectPool- The object pool to compare.- Returns:
trueif the givenobject poolhas the same objects as this one.
-
stream
public Stream<T> stream()
Description copied from interface:ReadableObjectPoolThis method is a short call for supplying a stream access to the graphs in the pool.- Specified by:
streamin interfaceReadableObjectPool<T extends DataObject>- Returns:
- a stream of the pool objects
-
-