Interface SimilarityCache

All Superinterfaces:
Iterable<Map.Entry<DataObjectPair,Similarity>>
All Known Implementing Classes:
AbstractSimilarityCache, CaffeineSimilarityCache, FileBasedCaffeineSimilarityCache, SimpleSimilarityCache

public interface SimilarityCache extends Iterable<Map.Entry<DataObjectPair,Similarity>>
Main interface for all similarity caches
  • Method Details

    • addListener

      void addListener(SimCacheListener listener)
      Adds a listener to the cache
      Parameters:
      listener - the listener to be attached to the cache
    • removeListener

      void removeListener(SimCacheListener listener)
      Removes a listener from the cache
      Parameters:
      listener - the listener to be detached from the cache
    • containsSimilarity

      boolean containsSimilarity(DataObject queryObject, DataObject caseObject)
      Parameters:
      queryObject - data object
      caseObject - data object
      Returns:
      whether the cache is holding an entry for queryObject and caseObject
    • getSimilarity

      Similarity getSimilarity(DataObject queryObject, DataObject caseObject)
      Parameters:
      queryObject - data object
      caseObject - data object
      Returns:
      the similarity of queryObject and caseObject (if the cache contains such an entry), null (otherwise)
    • setSimilarity

      void setSimilarity(DataObject queryObject, DataObject caseObject, Similarity similarity)
      Puts a new entry into the cache, the IDs of queryObject and caseObject as the key and similarity as its value.
      Parameters:
      queryObject - data object
      caseObject - data object
      similarity - the similarity of queryObject and caseObject
    • getSimilarities

      Collection<Similarity> getSimilarities()
      Returns:
      all similarity objects from the cache
    • clear

      void clear()
      Removes all similarities from the cache
    • size

      long size()
      Returns:
      number of entries in the cache
    • getLastTimeNanosForGetSimilarity

      long getLastTimeNanosForGetSimilarity()
      Returns:
      last time in nanoseconds for reading the cache
    • isEmpty

      boolean isEmpty()
      Returns:
      whether the cache holds no entries