absurdist
Interface LinkSimCache

All Known Implementing Classes:
LinkSimCacheArray, LinkSimCacheHash

interface LinkSimCache

The interface for a structure used to cache information about link similarity. Used in ABSURDIST's for fast excitation computation. The interface can be implemented as a hash table using the (Link,Link) pair as a key, or in a more complex way.


Method Summary
 double get(Link lo, Link ln)
          Retrieves the value representing Sim(lo,ln), or NaN if none was stored)
 double put(Link lo, Link ln, double val)
          Stores the value representing Sim(lo,ln).
 void setSizes(int loCnt, int lnCnt)
          Tell the table how much data will be stored: maximum number of distinct lo and ln Links.
 int size()
          Returns the number of values stored
 

Method Detail

setSizes

public void setSizes(int loCnt,
                     int lnCnt)
Tell the table how much data will be stored: maximum number of distinct lo and ln Links. The concrete class implementing LinkSimCache may do something with these data (e.g., allocate arrays), or just ignore them.

Parameters:
loCnt - How many distinct values for the first argument to put() are expected.
lnCnt - How many distinct values for the second argument to put() are expected.

put

public double put(Link lo,
                  Link ln,
                  double val)
Stores the value representing Sim(lo,ln). Returns the value previously stored in the table (NaN if none was stored)


get

public double get(Link lo,
                  Link ln)
Retrieves the value representing Sim(lo,ln), or NaN if none was stored)


size

public int size()
Returns the number of values stored