anthill.util
Class TreeList
java.lang.Object
|
+--anthill.util.MapList
|
+--anthill.util.TreeList
- All Implemented Interfaces:
- Clearable, java.util.Map, java.lang.Runnable
- public class TreeList
- extends MapList
This class implements a TreeList, which is a combination of a TreeMap
and a doubly linked list. The linked listed is always in sorted order
according to the least recently used (LRU) scheme, while the TreeMap
is sorted according to the keys of the map.
- Version:
- $Revision$
- Author:
- Hein Meling
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary |
protected java.util.SortedMap |
proxyMap
A proxy for the actual map, used to access methods
from the SortedMap interface. |
Fields inherited from class anthill.util.MapList |
map |
Constructor Summary |
TreeList(int maxsize)
Instantiate a new TreeList object by setting the maximum number of
key, value pairs which may be contained in it. |
TreeList(int maxsize,
int maxtime)
Instantiate a new TreeList object by setting the maximum number of
key, value pairs which may be contained in it. |
Method Summary |
java.lang.Object[] |
get(java.lang.Object key,
int valuecount)
Returns a set of object values whose keys closely match that of key.
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class anthill.util.MapList |
add, clear, containsKey, containsValue, end, entrySet, get, getHeadKey, getMaxsize, getMaxtime, isEmpty, keyList, keySet, put, putAll, remove, removeChunck, run, setMaxsize, setMaxtime, size, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
proxyMap
protected java.util.SortedMap proxyMap
- A proxy for the actual map, used to access methods
from the SortedMap interface.
TreeList
public TreeList(int maxsize,
int maxtime)
- Instantiate a new TreeList object by setting the maximum number of
key, value pairs which may be contained in it.
- Parameters:
maxsize
- Maximum number of objects which may be contained in
this TreeList. If zero, there is no upper limit to the the size.
TreeList
public TreeList(int maxsize)
- Instantiate a new TreeList object by setting the maximum number of
key, value pairs which may be contained in it.
- Parameters:
maxsize
- Maximum number of objects which may be contained in
this TreeList. If zero, there is no upper limit to the the size.
get
public java.lang.Object[] get(java.lang.Object key,
int valuecount)
- Returns a set of object values whose keys closely match that of key.
The valuecount specifies how may values around the key should be
returned. If not enough keys/values can be found, a null entry
is returned in the remaining positions in the returned array.
Note that the valuecount is bounded within MAX_VALUES.
- Parameters:
key
- key whose closely associated values is to be returned.valuecount
- how many values to return.- Returns:
- value set matching or closely matching the specified key.
main
public static void main(java.lang.String[] args)