|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.util.NNLookup<V>
public class NNLookup<V>
A collection of objects and associated integer keys, with support for
nearest-neighbor lookups. In other words, this is a Map
with integer keys, and the get(int key)
method retrieves the
object whose key is numerically closest to key
.
Constructor Summary | |
---|---|
NNLookup()
|
Method Summary | |
---|---|
void |
add(int key,
V object)
Add the object object using key as its index. |
V |
delete(int key)
Deletes the object with the key nearest to the specified key. |
Object |
deleteExact(int key)
Deletes the object with the specified key. |
V |
get(int key)
Get an object using the key key . |
Integer |
getClosestKey(int key)
Get the key closest to the one passed in. |
V |
getExact(int key)
Gets the object using this exact key. |
int |
size()
Returns the number of key-value pairs stored in this map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NNLookup()
Method Detail |
---|
public void add(int key, V object)
object
using key
as its index.
key
- The key to associated with object
.object
- The object to be stored.public V getExact(int key)
key
, returns null
. This is the normal Map behavior.
key
- The integer key value to search for.
public V get(int key)
key
. Gets the object whose key is
numerically closest to the one passed in.
key
- The integer key value to search for.
null
iff
the lookup table is empty.public V delete(int key)
key
- The key value you want to delete.
public Object deleteExact(int key)
key
- The key value you want to delete.
public Integer getClosestKey(int key)
key
- The key value to search for.
public int size()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |