Class SimilarityCacheCalculator<T extends DataObject>

All Implemented Interfaces:
Direct Known Subclasses:

public class SimilarityCacheCalculator<T extends DataObject> extends Object implements ThreadPoolExecutorListener
Multithreaded calculator to compute all pairwise similarities between data objects stored in a given pool. The computed similarities are stored in the given cache. Please note that by default, existing similarities in the cache are not overwritten. If you would like to do a complete rebuild just clear the cache before or set the corresponding flag.

Make sure that the similarity cache is thread safe!

In addition to the similarity cache, an internal similarity cache can be set to the internal similarity valuator for caching local similarities.
  • Constructor Details

    • SimilarityCacheCalculator

      public SimilarityCacheCalculator()
    • SimilarityCacheCalculator

      public SimilarityCacheCalculator(int numberOfThreads)
      numberOfThreads - threads to run in parallel
    • SimilarityCacheCalculator

      public SimilarityCacheCalculator(int numberOfThreads, long timeoutMillisPerCalculation)
      numberOfThreads - threads to run in parallel
      timeoutMillisPerCalculation - timeout to abort a calculation task
  • Method Details

    • compute

      public void compute()
      Perform similarity computation for given data objects
    • isComputeSelfSimilarities

      public boolean isComputeSelfSimilarities()
    • setComputeSelfSimilarities

      public void setComputeSelfSimilarities(boolean computeSelfSimilarities)
    • isOverwriteExistingSimilarities

      public boolean isOverwriteExistingSimilarities()
    • setOverwriteExistingSimilarities

      public void setOverwriteExistingSimilarities(boolean overwriteExistingSimilarities)
    • getSimilarityCache

      public SimilarityCache getSimilarityCache()
    • setSimilarityCache

      public void setSimilarityCache(SimilarityCache similarityCache)
    • getSimilarityValuator

      public SimilarityValuator getSimilarityValuator()
    • setSimilarityValuator

      public void setSimilarityValuator(SimilarityValuator similarityValuator)
    • getObjectPool

      public ReadableObjectPool<T> getObjectPool()
    • setObjectPool

      public void setObjectPool(ReadableObjectPool<T> objectPool)
    • getObjectComparator

      public Comparator<T> getObjectComparator()
    • setObjectComparator

      public void setObjectComparator(Comparator<T> objectComparator)
    • executionTaskCompleted

      public void executionTaskCompleted(long threadId, long taskId, long runtimeMillis, int numberOfCompletedTasks)
      Specified by:
      executionTaskCompleted in interface ThreadPoolExecutorListener