|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.cesr.lara.components.container.memory.impl.LDefaultLimitedCapacityOverwriteMemory<PropertyType>
PropertyType - public class LDefaultLimitedCapacityOverwriteMemory<PropertyType extends LaraProperty<PropertyType,?>>
TODO check if an interface split is appropriate (because step-related queries are not applicable to this kind of memory) (SH) TODO check: observation mechanism: at refresh, first input and then check capacity....
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface de.cesr.lara.components.container.storage.LaraStorageListener |
|---|
LaraStorageListener.StorageEvent |
| Field Summary | |
|---|---|
static int |
DEFAULT_INITIAL_CAPACITY
The memory's initial capacity in amount of entries |
| Fields inherited from interface de.cesr.lara.components.container.memory.LaraMemory |
|---|
UNLIMITED_RETENTION |
| Fields inherited from interface de.cesr.lara.components.container.LaraContainer |
|---|
UNLIMITED_CAPACITY |
| Constructor Summary | |
|---|---|
LDefaultLimitedCapacityOverwriteMemory()
|
|
LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager)
|
|
LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
int capacity)
|
|
LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
int capacity,
String name)
|
|
LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
String name)
|
|
LDefaultLimitedCapacityOverwriteMemory(String name)
|
|
| Method Summary | ||
|---|---|---|
void |
addMemoryPropertyObserver(LaraMemoryListener.MemoryEvent eventType,
LaraMemoryListener listener)
Adds a given LaraMemoryListener for the specified
LaraMemoryListener.MemoryEvent |
|
void |
clear()
Clears the memory, i.e. removes all properties. |
|
boolean |
contains(Class<?> propertyType,
String key)
Checks whether the memory contains a property of the given type with the given key. |
|
boolean |
contains(PropertyType property)
Checks whether the memory contains the given LaraProperty. |
|
boolean |
contains(PropertyType property,
String key)
Checks whether the memory contains the given LaraProperty with
the given key. |
|
boolean |
contains(String key)
Checks whether the memory contains a LaraProperty with the given
key. |
|
boolean |
contains(String key,
int timestamp)
Checks whether this memories contains a property with the given key that has the given time-stamp. |
|
protected LaraOverwriteStorage<PropertyType> |
createBackingStorage(LaraCapacityManager<PropertyType> capacityManager)
Overwrite this method in order to change the storage to be used by the memory. |
|
PropertyType |
forget(PropertyType propertyToRemove)
Removes the specified property from this memory. |
|
PropertyType |
forget(String key)
|
|
PropertyType |
forget(String key,
int step)
Removes the property with the specified key that was memorised in step from this memory. |
|
Collection<PropertyType> |
forgetAll(Collection<PropertyType> propertiesToBeRemoved)
Removes all properties in the specified collection from this memory. |
|
Collection<PropertyType> |
forgetAll(String key)
Forwarding to forget(key) since there is at maximum one entry. |
|
Set<String> |
getAllPropertyKeys()
Returns a set of Strings that represent the keys of properties memorised in the memory such that any property in the memory is represented. |
|
int |
getCapacity()
Returns the capacity of this container, i.e. the number of items that can be stored or LaraContainer.UNLIMITED_CAPACITY (the default) if it is
(virtually) unlimited. |
|
LaraCapacityManagementView<PropertyType> |
getCapacityManagementView()
|
|
LaraCapacityManager<PropertyType> |
getCapacityManager()
|
|
int |
getDefaultRetentionTime()
Return the default retention time |
|
String |
getName()
Returns the name of this memory |
|
int |
getRetentionTime(PropertyType property)
Returns the remaining retention time for the given property. |
|
int |
getSize()
Returns the current size, i.e. the number of items currently stored. |
|
boolean |
isEmpty()
Returns true, if and only if this container is empty. |
|
boolean |
isFull()
Returns true, if and only if this container is full (see also LaraCapacityManager). |
|
Iterator<PropertyType> |
iterator()
|
|
void |
memorize(PropertyType propertyToMemorize)
Tries to add the specified property to this memory applying the default retention time. |
|
void |
memorize(PropertyType propertyToMemorize,
int retentionTime)
Retention time is ignored! |
|
|
recall(Class<RequestPropertyType> propertyType,
String key)
Generic method that returns the most recently memorised property that is of the specified type (including sub types) and identified with key. |
|
|
recall(Class<RequestPropertyType> propertyType,
String key,
int step)
Generic method that returns the first property found that is of the specified type (including sub types), was memorised in step and
identified with key. |
|
PropertyType |
recall(String key)
Generic method that returns the most recently memorised property that is identified with key. |
|
PropertyType |
recall(String key,
int step)
Retention time is ignored! |
|
|
recallAll(Class<RequestPropertyType> propertyType)
Generic method that returns a collection of all properties found that are of the specified type (including sub types). |
|
|
recallAll(Class<RequestPropertyType> propertyType,
String key)
Generic method that returns a collection of all properties found that are of the specified type (including sub types)and are identified by key. |
|
Collection<PropertyType> |
recallAll(String key)
Generic method that returns a collection of all properties found that are identified by key. |
|
void |
refresh(PropertyType propertyToMemorize)
Since the Overwrite Memory only stores one property per key the refresh method is equal to memorise. |
|
void |
refresh(PropertyType propertyToMemorize,
int retentionTime)
Refreshes the property from this memory and assigns the given retention time. |
|
void |
refresh(String key)
Since the Overwrite Memory only stores one property per key the refresh method is equal to memorise. |
|
void |
refresh(String key,
int step)
Since the Overwrite Memory only stores one property per key the refresh method is equal to memorise. |
|
void |
refresh(String key,
int step,
int retentionTime)
Refreshes the property with the specified key that was memorised last from this memory and assigns the given retention time. |
|
void |
removeMemoryPropertyObserver(LaraMemoryListener.MemoryEvent eventType,
LaraMemoryListener listener)
|
|
boolean |
setCapacity(int capacity)
|
|
void |
setCapacityManager(LaraCapacityManager<PropertyType> manager)
|
|
void |
setDefaultRetentionTime(int defaultRetentionTime)
Sets the default retention time |
|
void |
storageEventOccured(LaraStorageListener.StorageEvent event,
LaraProperty<?,?> property)
|
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_INITIAL_CAPACITY
| Constructor Detail |
|---|
public LDefaultLimitedCapacityOverwriteMemory()
public LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager)
capacityManager -
public LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
int capacity)
capacityManager - capacity -
public LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
int capacity,
String name)
capacityManager - capacity - name - the memory's name
public LDefaultLimitedCapacityOverwriteMemory(LaraCapacityManager<PropertyType> capacityManager,
String name)
capacityManager - name - the memory's namepublic LDefaultLimitedCapacityOverwriteMemory(String name)
name - the memory's name| Method Detail |
|---|
public void addMemoryPropertyObserver(LaraMemoryListener.MemoryEvent eventType,
LaraMemoryListener listener)
LaraMemoryLaraMemoryListener for the specified
LaraMemoryListener.MemoryEvent
addMemoryPropertyObserver in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>eventType - the category of memory property events the listeners shall be
registered forlistener - the listener to be registeredLaraMemory.addMemoryPropertyObserver(de.cesr.lara.components.container.memory.LaraMemoryListener.MemoryEvent,
de.cesr.lara.components.container.memory.LaraMemoryListener)
public void clear()
throws LRemoveException
LaraMemory
clear in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LRemoveExceptionLaraMemory.clear()
public boolean contains(Class<?> propertyType,
String key)
LaraMemory
contains in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LaraMemory.contains(java.lang.Class,
java.lang.String)public boolean contains(PropertyType property)
LaraMemoryLaraProperty.
contains in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LaraMemory.contains(de.cesr.lara.components.LaraProperty)
public boolean contains(PropertyType property,
String key)
LaraMemoryLaraProperty with
the given key.
contains in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LaraMemory.contains(de.cesr.lara.components.LaraProperty,
java.lang.String)public boolean contains(String key)
LaraMemoryLaraProperty with the given
key.
contains in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LaraMemory.contains(java.lang.String)
public boolean contains(String key,
int timestamp)
contains in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>LaraMemory.contains(java.lang.String,
int)
public PropertyType forget(PropertyType propertyToRemove)
throws LRemoveException
LaraMemory
forget in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>propertyToRemove - the property to be removed.
LRemoveException
public PropertyType forget(String key)
throws LRemoveException
forget in interface LaraOverwriteMemory<PropertyType extends LaraProperty<PropertyType,?>>LRemoveException
public PropertyType forget(String key,
int step)
throws LRemoveException
LaraMemorystep from this memory.
forget in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be removed.step - the step in which the property to be removed was memorised.
LRemoveException
public Collection<PropertyType> forgetAll(Collection<PropertyType> propertiesToBeRemoved)
throws LRemoveException
LaraMemory
forgetAll in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>forgetAll in interface LaraOverwriteMemory<PropertyType extends LaraProperty<PropertyType,?>>propertiesToBeRemoved - the properties to be removed
LRemoveExceptionLaraMemory.forgetAll(java.util.Collection)
public Collection<PropertyType> forgetAll(String key)
throws LRemoveException
forgetAll in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - key identifier for the properties to be removed.
LRemoveExceptionLaraMemory.forgetAll(java.lang.String)public Set<String> getAllPropertyKeys()
LaraMemory
getAllPropertyKeys in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>public int getCapacity()
LaraContainerLaraContainer.UNLIMITED_CAPACITY (the default) if it is
(virtually) unlimited.
getCapacity in interface LaraContainer<PropertyType extends LaraProperty<PropertyType,?>>public LaraCapacityManagementView<PropertyType> getCapacityManagementView()
getCapacityManagementView in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<PropertyType,?>>public LaraCapacityManager<PropertyType> getCapacityManager()
getCapacityManager in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<PropertyType,?>>public int getDefaultRetentionTime()
LaraMemory
getDefaultRetentionTime in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>public String getName()
LaraMemory
getName in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>public int getRetentionTime(PropertyType property)
LaraMemory
getRetentionTime in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>public int getSize()
LaraContainer
getSize in interface LaraContainer<PropertyType extends LaraProperty<PropertyType,?>>public boolean isEmpty()
LaraContainer
isEmpty in interface LaraContainer<PropertyType extends LaraProperty<PropertyType,?>>public boolean isFull()
LaraContainerLaraCapacityManager).
isFull in interface LaraContainer<PropertyType extends LaraProperty<PropertyType,?>>public Iterator<PropertyType> iterator()
iterator in interface Iterable<PropertyType extends LaraProperty<PropertyType,?>>
public void memorize(PropertyType propertyToMemorize)
throws LContainerFullException,
LInvalidTimestampException
LaraMemory
memorize in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>propertyToMemorize - the property to be memorised.
LContainerFullException
LInvalidTimestampException
public void memorize(PropertyType propertyToMemorize,
int retentionTime)
throws LContainerFullException,
LInvalidTimestampException
memorize in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>propertyToMemorize - the property to be memorised.
LContainerFullException
LInvalidTimestampExceptionLaraMemory.memorize(de.cesr.lara.components.LaraProperty,
int)
public <RequestPropertyType extends PropertyType> RequestPropertyType recall(Class<RequestPropertyType> propertyType,
String key)
throws LRetrieveException
LaraMemorykey.
recall in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be retrieved.
key.
LRetrieveExceptionLaraMemory.recall(java.lang.Class,
java.lang.String)
public <RequestPropertyType extends PropertyType> RequestPropertyType recall(Class<RequestPropertyType> propertyType,
String key,
int step)
throws LRetrieveException
LaraMemorystep and
identified with key.
recall in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be retrieved.step - step in which the property was memorised.
step and identified with key.
LRetrieveExceptionLaraMemory.recall(java.lang.Class,
java.lang.String, int)
public PropertyType recall(String key)
throws LRetrieveException
LaraMemorykey.
recall in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be retrieved.
key.
LRetrieveExceptionLaraMemory.recall(java.lang.String)
public PropertyType recall(String key,
int step)
throws LRetrieveException
recall in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be retrieved.step - step in which the property was memorised.
step and
identified with key.
LRetrieveExceptionLaraMemory.recall(java.lang.String,
int)
public <RequestPropertyType extends PropertyType> Collection<RequestPropertyType> recallAll(Class<RequestPropertyType> propertyType)
throws LRetrieveException
LaraMemory
recallAll in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>step and identified with key.
LRetrieveExceptionLaraMemory.recallAll(java.lang.Class)
public <RequestPropertyType extends PropertyType> Collection<RequestPropertyType> recallAll(Class<RequestPropertyType> propertyType,
String key)
throws LRetrieveException
LaraMemorykey.
recallAll in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the properties to be retrieved.
step and identified with key.
LRetrieveExceptionLaraMemory.recallAll(java.lang.Class,
java.lang.String)
public Collection<PropertyType> recallAll(String key)
throws LRetrieveException
LaraMemorykey.
recallAll in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the properties to be retrieved.
step and identified with key.
LRetrieveException
public void refresh(PropertyType propertyToMemorize)
throws LContainerFullException,
LInvalidTimestampException
refresh in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>propertyToMemorize - the property to be memorised.
LContainerFullException
LInvalidTimestampExceptionLaraMemory.refresh(de.cesr.lara.components.LaraProperty)
public void refresh(PropertyType propertyToMemorize,
int retentionTime)
throws LInvalidTimestampException,
LRemoveException
LaraMemory
refresh in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>propertyToMemorize - the property to be memorised.retentionTime - time the property lasts in memory
LInvalidTimestampException
LRemoveException
public void refresh(String key)
throws LRemoveException
refresh in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be refreshed.
LRemoveExceptionLaraMemory.refresh(java.lang.String)
public void refresh(String key,
int step)
throws LRemoveException
refresh in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>key - identifier for the property to be refreshed.step - the step in which the property to be removed was memorised.
LRemoveExceptionLaraMemory.refresh(java.lang.String,
int)
public void refresh(String key,
int step,
int retentionTime)
throws LInvalidTimestampException,
LRemoveException
LaraMemory
refresh in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>retentionTime - time the property lasts in memory
LInvalidTimestampException
LRemoveException
public void removeMemoryPropertyObserver(LaraMemoryListener.MemoryEvent eventType,
LaraMemoryListener listener)
removeMemoryPropertyObserver in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>eventType - the category of memory property events the listeners shall be
removed fromlistener - the listener to be removedpublic boolean setCapacity(int capacity)
setCapacity in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<PropertyType,?>>public void setCapacityManager(LaraCapacityManager<PropertyType> manager)
setCapacityManager in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<PropertyType,?>>public void setDefaultRetentionTime(int defaultRetentionTime)
LaraMemory
setDefaultRetentionTime in interface LaraMemory<PropertyType extends LaraProperty<PropertyType,?>>defaultRetentionTime - the default retention time
public void storageEventOccured(LaraStorageListener.StorageEvent event,
LaraProperty<?,?> property)
storageEventOccured in interface LaraStorageListenerevent - the type of LaraMemoryListener.MemoryEvent that occurredproperty - the property that is affectedpublic String toString()
toString in class Objectprotected LaraOverwriteStorage<PropertyType> createBackingStorage(LaraCapacityManager<PropertyType> capacityManager)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||