Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database
Class DistanceCache<D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.database.DistanceCache<D>

public class DistanceCache<D extends Distance<D>>
extends Object

Provides a cache for distances between database objects.

Author:
Elke Achtert

Field Summary
private  Map<Integer,Map<Integer,D>> cache
          The map holding the pairwise distances.
 
Constructor Summary
DistanceCache()
           
 
Method Summary
 boolean containsKey(Integer id1, Integer id2)
          Returns true if this cache contains a distance value for the specified ids.
 D get(Integer id1, Integer id2)
          Returns the distance value of the specified ids if it has been cached, null otherwise.
 void put(Integer id1, Integer id2, D distance)
          Puts the specified distance value for the given ids to cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private Map<Integer,Map<Integer,D extends Distance<D>>> cache
The map holding the pairwise distances.

Constructor Detail

DistanceCache

public DistanceCache()
Method Detail

put

public void put(Integer id1,
                Integer id2,
                D distance)
Puts the specified distance value for the given ids to cache.

Parameters:
id1 - the first id
id2 - the second id
distance - the distance value

get

public D get(Integer id1,
             Integer id2)
Returns the distance value of the specified ids if it has been cached, null otherwise.

Parameters:
id1 - the first id
id2 - the second id
Returns:
the distance value of the specified ids if it has been cached, null otherwise

containsKey

public boolean containsKey(Integer id1,
                           Integer id2)
Returns true if this cache contains a distance value for the specified ids.

Parameters:
id1 - the first id
id2 - the second id
Returns:
true if this cache contains a distance value for the specified ids, false otherwise

Release 0.1 (2008-07-10_1838)