|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.cesr.lara.components.container.memory.impl.LDefaultMemory<PropertyType>
PropertyType
- public class LDefaultMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
TODO memory observer pattern!
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.cesr.lara.components.container.storage.LaraStorageListener |
---|
LaraStorageListener.StorageEvent |
Field Summary |
---|
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 | |
---|---|
LDefaultMemory()
|
|
LDefaultMemory(int defaultRetentionTime)
|
|
LDefaultMemory(int defaultRetentionTime,
String name)
|
|
LDefaultMemory(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 the memory contains a LaraProperty with the given
key for the given time stamp. |
|
protected LaraStorage<PropertyType> |
createBackingStorage()
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,
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)
Removes all properties that are identified by the specified key. |
|
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. |
|
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)
Tries to add the specified property to this memory with the given retention time. |
|
|
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)
Generic method that returns the first property that was memorised in step and identified with key . |
|
|
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 propertyToRefresh)
Tries to refresh the specified property in this memory applying the default retention time. |
|
void |
refresh(PropertyType propertyToRefresh,
int retentionTime)
Refreshes the property from this memory and assigns the given retention time. |
|
void |
refresh(String key)
Refreshes the property with the specified key that was memorised last from this memory. |
|
void |
refresh(String key,
int step)
Refreshes the property with the specified key that was memorised in step from this memory. |
|
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)
|
|
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 |
Constructor Detail |
---|
public LDefaultMemory()
public LDefaultMemory(int defaultRetentionTime)
defaultRetentionTime
- public LDefaultMemory(int defaultRetentionTime, String name)
defaultRetentionTime
- name
- the memory's namepublic LDefaultMemory(String name)
name
- the memory's nameMethod Detail |
---|
public void addMemoryPropertyObserver(LaraMemoryListener.MemoryEvent eventType, LaraMemoryListener listener)
LaraMemory
LaraMemoryListener
for the specified
LaraMemoryListener.MemoryEvent
addMemoryPropertyObserver
in interface LaraMemory<PropertyType extends LaraProperty<? extends 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<? extends PropertyType,?>>
LRemoveException
public boolean contains(Class<?> propertyType, String key)
LaraMemory
contains
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.contains(java.lang.Class,
java.lang.String)
public boolean contains(PropertyType property)
LaraMemory
LaraProperty
.
contains
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.contains(de.cesr.lara.components.LaraProperty)
public boolean contains(PropertyType property, String key)
LaraMemory
LaraProperty
with
the given key.
contains
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.contains(de.cesr.lara.components.LaraProperty,
java.lang.String)
public boolean contains(String key)
LaraMemory
LaraProperty
with the given
key.
contains
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.contains(java.lang.String)
public boolean contains(String key, int timestamp)
LaraMemory
LaraProperty
with the given
key for the given time stamp.
contains
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.contains(java.lang.String,
int)
public PropertyType forget(PropertyType propertyToRemove) throws LRemoveException
LaraMemory
forget
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
propertyToRemove
- the property to be removed.
LRemoveException
public PropertyType forget(String key, int step) throws LRemoveException
LaraMemory
step
from this memory.
forget
in interface LaraMemory<PropertyType extends LaraProperty<? extends 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<? extends PropertyType,?>>
propertiesToBeRemoved
- the properties to be removed
LRemoveException
public Collection<PropertyType> forgetAll(String key) throws LRemoveException
LaraMemory
forgetAll
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- key identifier for the properties to be removed.
LRemoveException
public Set<String> getAllPropertyKeys()
LaraMemory
getAllPropertyKeys
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.getAllPropertyKeys()
public int getCapacity()
LaraContainer
LaraContainer.UNLIMITED_CAPACITY
(the default) if it is
(virtually) unlimited.
getCapacity
in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
public int getDefaultRetentionTime()
LaraMemory
getDefaultRetentionTime
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
public String getName()
LaraMemory
getName
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraMemory.getName()
public int getRetentionTime(PropertyType property)
LaraMemory
getRetentionTime
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
public int getSize()
LaraContainer
getSize
in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
public boolean isEmpty()
LaraContainer
isEmpty
in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
public boolean isFull()
LaraContainer
LaraCapacityManager
).
isFull
in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
public Iterator<PropertyType> iterator()
iterator
in interface Iterable<PropertyType extends LaraProperty<? extends PropertyType,?>>
public void memorize(PropertyType propertyToMemorize) throws LContainerFullException, LInvalidTimestampException
LaraMemory
memorize
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
propertyToMemorize
- the property to be memorised.
LContainerFullException
LInvalidTimestampException
public void memorize(PropertyType propertyToMemorize, int retentionTime) throws LContainerFullException, LInvalidTimestampException
LaraMemory
memorize
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
propertyToMemorize
- the property to be memorised.
LContainerFullException
LInvalidTimestampException
public <RequestPropertyType extends PropertyType> RequestPropertyType recall(Class<RequestPropertyType> propertyType, String key) throws LRetrieveException
LaraMemory
key
.
recall
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be retrieved.
key
.
LRetrieveException
LaraMemory.recall(java.lang.Class,
java.lang.String)
public <RequestPropertyType extends PropertyType> RequestPropertyType recall(Class<RequestPropertyType> propertyType, String key, int step) throws LRetrieveException
LaraMemory
step
and
identified with key
.
recall
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be retrieved.step
- step in which the property was memorised.
step
and identified with key
.
LRetrieveException
LaraMemory.recall(java.lang.Class,
java.lang.String, int)
public PropertyType recall(String key) throws LRetrieveException
LaraMemory
key
.
recall
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be retrieved.
key
.
LRetrieveException
public PropertyType recall(String key, int step) throws LRetrieveException
LaraMemory
step
and identified with key
.
recall
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be retrieved.step
- step in which the property was memorised.
step
and
identified with key
.
LRetrieveException
public <RequestPropertyType extends PropertyType> Collection<RequestPropertyType> recallAll(Class<RequestPropertyType> propertyType) throws LRetrieveException
LaraMemory
recallAll
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
step
and identified with key
.
LRetrieveException
LaraMemory.recallAll(java.lang.Class,
java.lang.String)
public <RequestPropertyType extends PropertyType> Collection<RequestPropertyType> recallAll(Class<RequestPropertyType> propertyType, String key) throws LRetrieveException
LaraMemory
key
.
recallAll
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the properties to be retrieved.
step
and identified with key
.
LRetrieveException
LaraMemory.recallAll(java.lang.Class,
java.lang.String)
public Collection<PropertyType> recallAll(String key) throws LRetrieveException
LaraMemory
key
.
recallAll
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the properties to be retrieved.
step
and identified with key
.
LRetrieveException
public void refresh(PropertyType propertyToRefresh) throws LContainerFullException, LInvalidTimestampException
LaraMemory
refresh
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
propertyToRefresh
- the property to be memorised.
LContainerFullException
LInvalidTimestampException
public void refresh(PropertyType propertyToRefresh, int retentionTime) throws LInvalidTimestampException, LRemoveException
LaraMemory
refresh
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
propertyToRefresh
- the property to be memorised.retentionTime
- time the property lasts in memory
LInvalidTimestampException
LRemoveException
public void refresh(String key) throws LRemoveException
LaraMemory
refresh
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be refreshed.
LRemoveException
(SH)
public void refresh(String key, int step) throws LRemoveException
LaraMemory
step
from this memory.
refresh
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
key
- identifier for the property to be refreshed.step
- the step in which the property to be removed was memorised.
LRemoveException
public void refresh(String key, int step, int retentionTime) throws LInvalidTimestampException, LRemoveException
LaraMemory
refresh
in interface LaraMemory<PropertyType extends LaraProperty<? extends 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<? extends PropertyType,?>>
eventType
- the category of memory property events the listeners shall be
removed fromlistener
- the listener to be removedLaraMemory.removeMemoryPropertyObserver(de.cesr.lara.components.container.memory.LaraMemoryListener.MemoryEvent,
de.cesr.lara.components.container.memory.LaraMemoryListener)
public void setDefaultRetentionTime(int defaultRetentionTime)
LaraMemory
setDefaultRetentionTime
in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
defaultRetentionTime
- the default retention timepublic void storageEventOccured(LaraStorageListener.StorageEvent event, LaraProperty<?,?> property)
storageEventOccured
in interface LaraStorageListener
event
- the type of LaraMemoryListener.MemoryEvent
that occurredproperty
- the property that is affectedpublic String toString()
toString
in class Object
protected LaraStorage<PropertyType> createBackingStorage()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |