jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap.bruteforce
Class BruteForcePagedSimilarity<D extends com.chemaxon.descriptors.common.Descriptor>

Object
  extended by com.chemaxon.overlap.bruteforce.BruteForcePagedSimilarity<D>
Type Parameters:
D - Represented descriptor type

public class BruteForcePagedSimilarity<D extends com.chemaxon.descriptors.common.Descriptor>
extends Object

Brute force paged similarity search.

This class is an immutable similarity query engine implementation.

Licensing: this class can be used with valid LicenseGlobals.OVERLAP license.

Author:
Gabor Imre

Nested Class Summary
(package private) static class BruteForcePagedSimilarity.DissimResult
           
(package private) static class BruteForcePagedSimilarity.SearchPage<D extends com.chemaxon.descriptors.common.Descriptor>
           
 
Constructor Summary
BruteForcePagedSimilarity(com.chemaxon.descriptors.common.DescriptorComparator<D> comparator, List<ImmutableList<D>> pages, List<D> page)
          Construct new immutable reference.
 
Method Summary
 ImmutableList<SimilarityResultNode> findMostSimilar(List<D> queries, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex)
          Brute force find most similar structure for a set of structures.
 SimilarityResultNode findMostSimilarOnSingleThread(D query, com.chemaxon.calculations.common.SubProgressObserver po)
          Find most similar for a given query structure.
 ImmutableList<SimilarityResultNode> findMostSimilarOnSingleThread(List<D> queries, com.chemaxon.calculations.common.SubProgressObserver po)
          Single threaded reference for multi query most similar lookup.
 ImmutableList<SimilarityResultNode> findMostSimilarsOnSingleThread(D query, com.chemaxon.calculations.common.SubProgressObserver po, int maxCount)
          Find most similars for a given query structure.
 int size()
          Total number of descriptors stored.
 BruteForcePagedSimilarity<D> withComparator(com.chemaxon.descriptors.common.DescriptorComparator<D> comparator)
          Construct another BruteForcePagedSimilarity instance representing a different comparator.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BruteForcePagedSimilarity

public BruteForcePagedSimilarity(com.chemaxon.descriptors.common.DescriptorComparator<D> comparator,
                                 List<ImmutableList<D>> pages,
                                 List<D> page)
Construct new immutable reference.

Parameters:
comparator - Comparator to be used
pages - List of descriptor pages. This parameter can not be null.
page - Additional descriptor page, considered as last page. Ignored if null given.
Throws:
chemaxon.license.LicenseException - when appropriate license is not available
Method Detail

withComparator

public BruteForcePagedSimilarity<D> withComparator(com.chemaxon.descriptors.common.DescriptorComparator<D> comparator)
Construct another BruteForcePagedSimilarity instance representing a different comparator.

This operation is memory efficient, since page storage is immutable thus reusable.

Parameters:
comparator - Comparator to be used
Returns:
Instance representing comparison with the given comparator

size

public int size()
Total number of descriptors stored.

Returns:
Size

findMostSimilar

public ImmutableList<SimilarityResultNode> findMostSimilar(List<D> queries,
                                                           com.chemaxon.calculations.common.SubProgressObserver po,
                                                           ExecutorService ex)
Brute force find most similar structure for a set of structures.

This method utilizes concurrent execution and blocks until completion. ProgressObserver callback is invoked from the calling thread only.

Parameters:
queries - Query descriptors
po - ProgressObserver to track progress
ex - ExecutorService to run workers
Returns:
List of most similar structures

findMostSimilarOnSingleThread

public ImmutableList<SimilarityResultNode> findMostSimilarOnSingleThread(List<D> queries,
                                                                         com.chemaxon.calculations.common.SubProgressObserver po)
                                                                  throws CancellationException
Single threaded reference for multi query most similar lookup.

Parameters:
queries - Queries to search
po - Observer; will be closed upon finish/abort/error. One work unit is assigned to one comparison.
Returns:
Results
Throws:
CancellationException - When cancelled through supplied progress observer

findMostSimilarOnSingleThread

public SimilarityResultNode findMostSimilarOnSingleThread(D query,
                                                          com.chemaxon.calculations.common.SubProgressObserver po)
                                                   throws CancellationException
Find most similar for a given query structure.

This method blocks until ready and uses a single (the calling) thread to do the calculation.

Parameters:
query - Query descriptor
po - Progress observer to track progress. Completion is reported by invoking SubProgressObserver.done() upon completion, cancellation or error
Returns:
The most similar structure found
Throws:
CancellationException - upon cancellation through the given progress observer

findMostSimilarsOnSingleThread

public ImmutableList<SimilarityResultNode> findMostSimilarsOnSingleThread(D query,
                                                                          com.chemaxon.calculations.common.SubProgressObserver po,
                                                                          int maxCount)
                                                                   throws CancellationException
Find most similars for a given query structure.

This method blocks until ready and uses a single (the calling) thread to do the calculation.

Parameters:
query - Query descriptor
po - Progress observer to track progress. Completion is reported by invoking SubProgressObserver.done() upon completion, cancellation or error
maxCount - Max results count
Returns:
List of at most the given number of most similars, in increasing dissimilarity order
Throws:
CancellationException - upon cancellation through the given progress observer

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)