de.cesr.lara.components.container.memory.impl
Class LDefaultLimitedCapacityMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>

java.lang.Object
  extended by de.cesr.lara.components.container.memory.impl.LDefaultMemory<PropertyType>
      extended by de.cesr.lara.components.container.memory.impl.LDefaultLimitedCapacityMemory<PropertyType>
Type Parameters:
PropertyType -
All Implemented Interfaces:
LaraCapacityManageableContainer<PropertyType>, LaraContainer<PropertyType>, LaraMemory<PropertyType>, LaraStorageListener, Iterable<PropertyType>
Direct Known Subclasses:
LDefaultLimitedCapacityBOMemory

public class LDefaultLimitedCapacityMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
extends LDefaultMemory<PropertyType>
implements LaraCapacityManageableContainer<PropertyType>


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.LaraContainer
UNLIMITED_CAPACITY
 
Fields inherited from interface de.cesr.lara.components.container.memory.LaraMemory
UNLIMITED_RETENTION
 
Constructor Summary
LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager)
           
LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager, int initialCapacity)
           
LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager, int initialCapacity, String name)
           
LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager, String name)
           
 
Method Summary
 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()
           
 boolean isFull()
          Returns true, if and only if this container is full (see also LaraCapacityManager).
 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.
 boolean setCapacity(int capacity)
           
 void setCapacityManager(LaraCapacityManager<PropertyType> manager)
           
 
Methods inherited from class de.cesr.lara.components.container.memory.impl.LDefaultMemory
addMemoryPropertyObserver, clear, contains, contains, contains, contains, contains, createBackingStorage, forget, forget, forgetAll, forgetAll, getAllPropertyKeys, getDefaultRetentionTime, getName, getRetentionTime, getSize, isEmpty, iterator, recall, recall, recall, recall, recallAll, recallAll, recallAll, refresh, refresh, refresh, refresh, refresh, removeMemoryPropertyObserver, setDefaultRetentionTime, storageEventOccured, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.cesr.lara.components.container.LaraContainer
getSize, isEmpty
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

DEFAULT_INITIAL_CAPACITY

public static final int DEFAULT_INITIAL_CAPACITY
The memory's initial capacity in amount of entries

See Also:
Constant Field Values
Constructor Detail

LDefaultLimitedCapacityMemory

public LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager)
Parameters:
capacityManager -

LDefaultLimitedCapacityMemory

public LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager,
                                     int initialCapacity)
Parameters:
capacityManager -
initialCapacity -

LDefaultLimitedCapacityMemory

public LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager,
                                     int initialCapacity,
                                     String name)
Parameters:
capacityManager -
initialCapacity -
name - the memory's name

LDefaultLimitedCapacityMemory

public LDefaultLimitedCapacityMemory(LaraCapacityManager<PropertyType> capacityManager,
                                     String name)
Parameters:
capacityManager -
name - the memory's name
Method Detail

getCapacity

public int getCapacity()
Description copied from interface: LaraContainer
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.

Specified by:
getCapacity in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
Overrides:
getCapacity in class LDefaultMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Returns:
the capacity of this storage.
See Also:
LDefaultMemory.getCapacity()

getCapacityManagementView

public LaraCapacityManagementView<PropertyType> getCapacityManagementView()
Specified by:
getCapacityManagementView in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
Returns:
See Also:
LaraCapacityManageableContainer.getCapacityManagementView()

getCapacityManager

public LaraCapacityManager<PropertyType> getCapacityManager()
Specified by:
getCapacityManager in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
Returns:
See Also:
LaraCapacityManageableContainer.getCapacityManager()

isFull

public boolean isFull()
Description copied from interface: LaraContainer
Returns true, if and only if this container is full (see also LaraCapacityManager).

Specified by:
isFull in interface LaraContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
Overrides:
isFull in class LDefaultMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Returns:
true, if and only if this container is full.
See Also:
LDefaultMemory.isFull()

memorize

public void memorize(PropertyType propertyToMemorize)
Description copied from interface: LaraMemory
Tries to add the specified property to this memory applying the default retention time. In case the memory already contains a property of the same key for the same time-stamp the "old" property is overwritten.

Specified by:
memorize in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Overrides:
memorize in class LDefaultMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Parameters:
propertyToMemorize - the property to be memorised.
See Also:
LDefaultMemory.memorize(de.cesr.lara.components.LaraProperty)

memorize

public void memorize(PropertyType propertyToMemorize,
                     int retentionTime)
Description copied from interface: LaraMemory
Tries to add the specified property to this memory with the given retention time. In case the memory already contains a property of the same key for the same time-stamp the "old" property is overwritten.

Specified by:
memorize in interface LaraMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Overrides:
memorize in class LDefaultMemory<PropertyType extends LaraProperty<? extends PropertyType,?>>
Parameters:
propertyToMemorize - the property to be memorised.
See Also:
LDefaultMemory.memorize(de.cesr.lara.components.LaraProperty, int)

setCapacity

public boolean setCapacity(int capacity)
Specified by:
setCapacity in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
Returns:
See Also:
LaraCapacityManageableContainer.setCapacity(int)

setCapacityManager

public void setCapacityManager(LaraCapacityManager<PropertyType> manager)
Specified by:
setCapacityManager in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<? extends PropertyType,?>>
See Also:
LaraCapacityManageableContainer.setCapacityManager(de.cesr.lara.components.container.LaraCapacityManager)