net.ontopia.utils
Class HistoryMap<T>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<java.lang.Integer,T>
net.ontopia.utils.HistoryMap<T>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Integer,T>
public class HistoryMap<T>
- extends java.util.HashMap<java.lang.Integer,T>
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
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
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. |
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 |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
maxEntries
protected int maxEntries
suppressDuplicates
protected boolean suppressDuplicates
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.
getMaxEntries
public int getMaxEntries()
doesSuppressDuplicates
public boolean doesSuppressDuplicates()
add
public void add(T obj)
removeEntry
public void removeEntry(T obj)
getEntry
public T getEntry(int index)
getEntries
public java.util.Collection<T> getEntries()
getEntriesReverse
public java.util.Collection getEntriesReverse()
Copyright © 2000-2012 Ontopia.