net.ontopia.utils
Class HistoryMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by net.ontopia.utils.HistoryMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class HistoryMap
extends java.util.HashMap

INTERNAL: Helper class for storing elements up to a certain amount, lower most elements will be removed to ensure a fixed size of the collection.

Since:
1.2.5
See Also:
Serialized Form

Constructor Summary
HistoryMap()
          Default constructor which uses 20 entries as the default history size and does suppress duplicates.
HistoryMap(int maxEntries, boolean suppressDuplicates)
          Constructor which allows to specify number of entries to store and duplicate suppression behaviour.
 
Method Summary
 void add(java.lang.Object obj)
           
 boolean doesSuppressDuplicates()
           
 java.util.Collection getEntries()
           
 java.util.Collection getEntriesReverse()
           
 java.lang.Object getEntry(int index)
           
 int getMaxEntries()
           
 void removeEntry(java.lang.Object obj)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

HistoryMap

public HistoryMap()
Default constructor which uses 20 entries as the default history size and does suppress duplicates.


HistoryMap

public HistoryMap(int maxEntries,
                  boolean suppressDuplicates)
Constructor which allows to specify number of entries to store and duplicate suppression behaviour.

Parameters:
maxEntries - Maxium number of entries to store in the history.
suppressDuplicates - Should suppress duplicate entries in map.
Method Detail

getMaxEntries

public int getMaxEntries()

doesSuppressDuplicates

public boolean doesSuppressDuplicates()

add

public void add(java.lang.Object obj)

removeEntry

public void removeEntry(java.lang.Object obj)

getEntry

public java.lang.Object getEntry(int index)

getEntries

public java.util.Collection getEntries()

getEntriesReverse

public java.util.Collection getEntriesReverse()


Copyright © 2000-2009 Ontopia.