de.cesr.lara.components.container.storage.impl
Class LDefaultLimitedCapacityStorage<PropertyType extends LaraProperty<PropertyType,?>>

java.lang.Object
  extended by de.cesr.lara.components.container.storage.impl.LDefaultStorage<PropertyType>
      extended by de.cesr.lara.components.container.storage.impl.LDefaultLimitedCapacityStorage<PropertyType>
Type Parameters:
PropertyType -
All Implemented Interfaces:
LaraCapacityManageableContainer<PropertyType>, LaraContainer<PropertyType>, LaraStorage<PropertyType>, Iterable<PropertyType>

public class LDefaultLimitedCapacityStorage<PropertyType extends LaraProperty<PropertyType,?>>
extends LDefaultStorage<PropertyType>
implements LaraCapacityManageableContainer<PropertyType>

TODO implement observer management for other events than AUTO_REMOVED!


Field Summary
static int DEFAULT_INITIAL_CAPACITY
          The storage's initial capacity in amount of entries
 
Fields inherited from interface de.cesr.lara.components.container.LaraContainer
UNLIMITED_CAPACITY
 
Constructor Summary
LDefaultLimitedCapacityStorage(LaraCapacityManager<PropertyType> capacityManager)
           
LDefaultLimitedCapacityStorage(LaraCapacityManager<PropertyType> capacityManager, int initialCapacity)
           
 
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).
 boolean setCapacity(int capacity)
           
 void setCapacityManager(LaraCapacityManager<PropertyType> manager)
           
 void store(PropertyType propertyToStore)
          Tries to add the specified property to this storage.
 
Methods inherited from class de.cesr.lara.components.container.storage.impl.LDefaultStorage
addStoragePropertyListener, clear, contains, contains, contains, contains, contains, fetch, fetch, fetch, fetch, fetchAll, fetchAll, fetchAll, fetchAll, getAllPropertyKeys, getPropertyListeners, getSize, isEmpty, iterator, propListenersContainsEventKey, remove, remove, removeAll, removeAll, removeStoragePropertyListener, 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 storage's initial capacity in amount of entries

See Also:
Constant Field Values
Constructor Detail

LDefaultLimitedCapacityStorage

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

LDefaultLimitedCapacityStorage

public LDefaultLimitedCapacityStorage(LaraCapacityManager<PropertyType> capacityManager,
                                      int initialCapacity)
Parameters:
capacityManager -
initialCapacity -
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<PropertyType,?>>
Overrides:
getCapacity in class LDefaultStorage<PropertyType extends LaraProperty<PropertyType,?>>
Returns:
the capacity of this storage.
See Also:
LDefaultStorage.getCapacity()

getCapacityManagementView

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

getCapacityManager

public LaraCapacityManager<PropertyType> getCapacityManager()
Specified by:
getCapacityManager in interface LaraCapacityManageableContainer<PropertyType extends LaraProperty<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<PropertyType,?>>
Overrides:
isFull in class LDefaultStorage<PropertyType extends LaraProperty<PropertyType,?>>
Returns:
true, if and only if this container is full.
See Also:
LDefaultStorage.isFull()

setCapacity

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

setCapacityManager

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

store

public void store(PropertyType propertyToStore)
Description copied from interface: LaraStorage
Tries to add the specified property to this storage. In case the storage already contains a property of the same key for the same time-stamp the "old" property is overwritten.

Specified by:
store in interface LaraStorage<PropertyType extends LaraProperty<PropertyType,?>>
Overrides:
store in class LDefaultStorage<PropertyType extends LaraProperty<PropertyType,?>>
Parameters:
propertyToStore - the property to be stored.
See Also:
LDefaultStorage.store(de.cesr.lara.components.LaraProperty)