Class SimpleSimilarityCache

All Implemented Interfaces:
SimilarityCache, Iterable<Map.Entry<DataObjectPair,Similarity>>

public class SimpleSimilarityCache extends AbstractSimilarityCache
Stores pairs of data object ids with their similarity in a simple multi-key hashmap
  • Constructor Details

    • SimpleSimilarityCache

      public SimpleSimilarityCache()
  • Method Details

    • setRecordStats

      public void setRecordStats(boolean recordStats)
    • setReadOnly

      public void setReadOnly(boolean readOnly)
    • size

      public long size()
      number of entries in the cache
    • containsSimilarity

      public boolean containsSimilarity(DataObject queryObject, DataObject caseObject)
      queryObject - data object
      caseObject - data object
      whether the cache is holding an entry for queryObject and caseObject
    • get

      protected Similarity get(DataObject queryObject, DataObject caseObject)
      Specified by:
      get in class AbstractSimilarityCache
    • setSimilarity

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

      public Collection<Similarity> getSimilarities()
      all similarity objects from the cache
    • remove

      protected void remove(String queryId, String caseId)
      Specified by:
      remove in class AbstractSimilarityCache
    • clear

      public void clear()
      Description copied from interface: SimilarityCache
      Removes all similarities from the cache
    • iterator

      @NotNull public @NotNull Iterator<Map.Entry<DataObjectPair,Similarity>> iterator()
    • spliterator