Package chemaxon.calculations.api
Class ProgressableCalculator<T,R>
java.lang.Object
chemaxon.calculations.api.ProgressableCalculator<T,R>
- Type Parameters:
T- type of the input data for calculationR- type of the result of calculation
- All Implemented Interfaces:
Calculator<T,,R> TaggedCalculator,Licensable
- Direct Known Subclasses:
DipoleCalculator,NMRCalculator
@PublicApi
public abstract class ProgressableCalculator<T,R>
extends Object
implements Calculator<T,R>, Licensable
An abstract calculator implementation which supports progress notification and cancellation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aPropertyChangeListenerto listen for property changesvoidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds aPropertyChangeListenerto listen for specified property changesvoidcancel()protected voidprotected voidcheckData(T data, String command, CalculatorLogger logger) protected final voidprotected voidprotected StringgetErrorMessage(List<CalculatorError> checkResults) abstract StringReturns the product identifier of the plugin.booleanfinal booleanChecks if the required license is available for using this class or product.booleanvoidRemoves a listener previously added withaddPropertyChangeListener(PropertyChangeListener), so the listener will not receive property changes of this calculationvoidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Removes a listener previously added withaddPropertyChangeListener(String, PropertyChangeListener), so the listener will not receive changes of specified propertyprotected voidsendProgress(float progress) final voidSets the current license environment identifier.protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface chemaxon.calculations.api.Calculator
calculate, checkMethods inherited from interface chemaxon.calculations.api.TaggedCalculator
tags
-
Field Details
-
PROGRESS
- See Also:
-
RUNNING
- See Also:
-
licenseEnvironment
-
cancelled
protected volatile boolean cancelled -
running
protected volatile boolean running
-
-
Constructor Details
-
ProgressableCalculator
public ProgressableCalculator()
-
-
Method Details
-
sendProgress
protected void sendProgress(float progress) -
cancel
public void cancel() -
isCancelled
public boolean isCancelled() -
isRunning
public boolean isRunning() -
startCalculation
protected void startCalculation() -
cancelCalculation
protected void cancelCalculation() -
finishCalculation
protected void finishCalculation() -
addPropertyChangeListener
Adds aPropertyChangeListenerto listen for property changes- Parameters:
listener- is the listener will be notified- See Also:
-
addPropertyChangeListener
Adds aPropertyChangeListenerto listen for specified property changes- Parameters:
propertyName- is the name of the property to listenlistener- is the listener will be notified- See Also:
-
removePropertyChangeListener
Removes a listener previously added withaddPropertyChangeListener(PropertyChangeListener), so the listener will not receive property changes of this calculation- See Also:
-
removePropertyChangeListener
Removes a listener previously added withaddPropertyChangeListener(String, PropertyChangeListener), so the listener will not receive changes of specified property- Parameters:
propertyName- is the name of the propertylistener- is the listener instance- See Also:
-
checkData
protected void checkData(T data, String command, CalculatorLogger logger) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getErrorMessage
-
isLicensed
public final boolean isLicensed()Description copied from interface:LicensableChecks if the required license is available for using this class or product.- Specified by:
isLicensedin interfaceLicensable- Returns:
- true if this software component is correctly licensed
-
setLicenseEnvironment
Description copied from interface:LicensableSets the current license environment identifier. For internal use only!- Specified by:
setLicenseEnvironmentin interfaceLicensable- Parameters:
env- license environment. It is string identifier of a certain integration environment.
-
getProductName
Returns the product identifier of the plugin. -
checkLicense
- Throws:
LicenseException
-