jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap.concurrent
Class BppFrontend<S,T>

Object
  extended by com.chemaxon.overlap.concurrent.BppFrontend<S,T>
Type Parameters:
S - Type of sources
T - Type of targets

 class BppFrontend<S,T>
extends Object

Batched paged processor frontend.

This class represents operations done on the main (calling) thread, like interacting with passed iterators and callback methods. This class interacts with the client code. This class is not synchronized; usually all invocations are needed to be made from the thread which the client code launched the processing.

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

Author:
Gabor Imre

Constructor Summary
BppFrontend(com.chemaxon.calculations.common.SubProgressObserver po, Iterator<S> source, Function<S,T> process, ErrorHandler<S> error, ResultHandler<S,T> target)
          Construct new instance.
 
Method Summary
(package private)  boolean hasNext()
          Check if has more source to be processed.
(package private)  ProcessPage<S,T> nextPage(int pagesize)
          Create next page to be submitted.
(package private)  void processResult(ProcessPage<S,T> result)
          Process result.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BppFrontend

BppFrontend(com.chemaxon.calculations.common.SubProgressObserver po,
            Iterator<S> source,
            Function<S,T> process,
            ErrorHandler<S> error,
            ResultHandler<S,T> target)
Construct new instance.

Parameters:
po - ProgressObserver to track execution
source - Sources
process - Task
error - Error sink
target - Results sink
Throws:
chemaxon.license.LicenseException - when appropriate license is not available
Method Detail

nextPage

ProcessPage<S,T> nextPage(int pagesize)
Create next page to be submitted.

This method should be called only from the main thread. If no more input present NoSuchElementException is thrown. Presence of further inputs can be queried using hasNext().

Parameters:
pagesize - Page size, number of inputs to bundle
Returns:
New page to be submitted to processing.
Throws:
NoSuchElementException - if the source has no more elements

processResult

void processResult(ProcessPage<S,T> result)
Process result.

This method should be called only from the main thread.

Parameters:
result - Result to process
Throws:
CancellationException - upon cancellation from encapsulated ProgressObserver

hasNext

boolean hasNext()
Check if has more source to be processed.

Returns:
True when source contains more inputs

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)