de.cesr.lara.components.util.impl
Class LCapacityManagers

java.lang.Object
  extended by de.cesr.lara.components.util.impl.LCapacityManagers

public final class LCapacityManagers
extends Object

Assumes that the storage has already checked that it is full! Capacity Management Policies:

UNLIMITED_CAPACITY: Memory is (virtually) unlimited in its capacity, i.e. items can be added at any time without forcing the removal of other items already in memory.

FIFO: First In - First Out (queue), i.e. when a new item is to be added to memory, but memory has already reached its maximum capacity, the oldest item in memory will be removed in order to free the necessary space for the new item. If there is more than one oldest item in terms of steps, then the one that actually entered memory first will be removed.

FILO: First In - Last Out (stack), i.e. when a new item is to be added to memory, but memory has already reached its maximum capacity, the item the newest item in memory will be removed in order to free the necessary space for the new item. If there is more than one newest item in terms of steps, then the one that actually entered memory last will be removed.

FIFO_RANDOM: The same as FIFO, except that if there is more than one oldest item in terms of steps, the one to be removed will be selected at random.

FILO_RANDOM: The same as FILO, except that if there is more than one newest item in terms of steps, the one to be removed will be selected at random.

NINO: None In - None Out, i.e. no more items can be added to memory once it has reached its maximum capacity, except if items in memory are removed explicitly or as a result of some temporal decay (cf. LaraLimitedRetentionMemory).

RANDOM: When a new item is to be added to memory, but memory has already reached its maximum capacity, an item in memory will be selected at random and removed in order to free the necessary space for the new item. TODO Capacity management, the way it is done here, i.e. by iterating over the whole set of entries, can be very time consuming. However, it should rarely be necessary anyway. (ME) A possible solution (for FIFO/LILO and FILO/LIFO at least) may be adding methods like removeFirst() and removeLast() to the LaraCapacityManagementView and leaving the definition of these up to the container that is viewed. (ME) TODO implement other managers (UNLIMITED_CAPACITY, RANDOM, FIFO_RANDOM, FILO_RANDOM)


Constructor Summary
LCapacityManagers()
           
 
Method Summary
static
<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraCapacityManager<PropertyType>
makeFIFO()
           
static
<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraCapacityManager<PropertyType>
makeFILO()
           
static
<PropertyType extends LaraProperty<? extends PropertyType,?>>
LaraCapacityManager<PropertyType>
makeNINO()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LCapacityManagers

public LCapacityManagers()
Method Detail

makeFIFO

public static final <PropertyType extends LaraProperty<? extends PropertyType,?>> LaraCapacityManager<PropertyType> makeFIFO()
Type Parameters:
PropertyType - the type of properties this container shall store
Returns:
capacity manager

makeFILO

public static final <PropertyType extends LaraProperty<? extends PropertyType,?>> LaraCapacityManager<PropertyType> makeFILO()
Type Parameters:
PropertyType - the type of properties the container stores this manager shall manage
Returns:
capacity manager

makeNINO

public static final <PropertyType extends LaraProperty<? extends PropertyType,?>> LaraCapacityManager<PropertyType> makeNINO()
Type Parameters:
PropertyType - the type of properties the container stores this manager shall manage
Returns:
capacity manager