com.j2r
Interface MapManagerStrategy

All Known Implementing Classes:
FiFoRemainingMemoryStrategy, FiFoStrategy

public interface MapManagerStrategy


Method Summary
 void clear()
          Clears all elements.
 java.lang.Object clone()
          Creates a shallow copy of this object, preserving the internal structure by copying only references.
 void decrease(int index, java.lang.Object key)
          Removes the element with the specified key or index.
 void freshenSequence(java.lang.Object key, java.lang.Object value)
          Freshens the sequence of the element value if value is not null.
 java.lang.Object get(int index)
          Returns the key at the specified index.
 ManagedMap getManagedMap()
           
 void increase(java.lang.Object key, java.lang.Object prevValue, java.lang.Object newValue)
          Stores the provided key/value pair.
 int indexOf(java.lang.Object key)
          Returns the index of the specified key.
 java.util.Iterator iterator()
          Returns a key iterator.
 int lastIndexOf(java.lang.Object key)
          Returns the last index of the specified key.
 void removeManagedMap()
           
 java.util.List sequence()
          Returns the ordered sequence of keys.
 void setManagedMap(ManagedMap managedMap)
           
 

Method Detail

clear

void clear()
Clears all elements.


clone

java.lang.Object clone()
Creates a shallow copy of this object, preserving the internal structure by copying only references. The keys, values, and sequence are not clone()'d.

Returns:
A clone of this instance.

decrease

void decrease(int index,
              java.lang.Object key)
Removes the element with the specified key or index.

Parameters:
index - The index of the object to remove, or UNKNOWN_INDEX if not known.
key - The Map key of the object to remove.

freshenSequence

void freshenSequence(java.lang.Object key,
                     java.lang.Object value)
Freshens the sequence of the element value if value is not null.

Parameters:
key - The key whose sequence to freshen.
value - The value whose existance to check before removing the old key sequence.

get

java.lang.Object get(int index)
Returns the key at the specified index.


getManagedMap

ManagedMap getManagedMap()

increase

void increase(java.lang.Object key,
              java.lang.Object prevValue,
              java.lang.Object newValue)
Stores the provided key/value pair. Freshens the sequence of existing elements.

Parameters:
key - The key to the provided value.
value - The value to store.

indexOf

int indexOf(java.lang.Object key)
Returns the index of the specified key.


iterator

java.util.Iterator iterator()
Returns a key iterator.


lastIndexOf

int lastIndexOf(java.lang.Object key)
Returns the last index of the specified key.


sequence

java.util.List sequence()
Returns the ordered sequence of keys. This method is meant to be used for retrieval of Key / Value pairs in e.g. Velocity:
 ## $table contains a sequenced map
 #foreach ($key in $table.sequence())
 <TR>
 <TD>Key: $key</TD>
 </TD>Value: $table.get($key)</TD>
 </TR>
 #end
 

Returns:
The ordered list of keys.

setManagedMap

void setManagedMap(ManagedMap managedMap)

removeManagedMap

void removeManagedMap()