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 similarities will be only computed if they are not existent in the given cache.

Make sure that the similarity cache is thread safe!

  • 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
    • getSimilarityCache

      public SimilarityCache getSimilarityCache()
    • setSimilarityCache

      public void setSimilarityCache(SimilarityCache similarityCache)
    • 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, int numberOfCompletedTasks)
      Specified by:
      executionTaskCompleted in interface ThreadPoolExecutorListener