Class ProgressableCalculator<T,R>

java.lang.Object
chemaxon.calculations.api.ProgressableCalculator<T,R>
Type Parameters:
T - type of the input data for calculation
R - 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 Details

    • PROGRESS

      public static final String PROGRESS
      See Also:
    • RUNNING

      public static final String RUNNING
      See Also:
    • licenseEnvironment

      protected String 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

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a PropertyChangeListener to listen for property changes
      Parameters:
      listener - is the listener will be notified
      See Also:
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Adds a PropertyChangeListener to listen for specified property changes
      Parameters:
      propertyName - is the name of the property to listen
      listener - is the listener will be notified
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a listener previously added with addPropertyChangeListener(PropertyChangeListener), so the listener will not receive property changes of this calculation
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Removes a listener previously added with addPropertyChangeListener(String, PropertyChangeListener), so the listener will not receive changes of specified property
      Parameters:
      propertyName - is the name of the property
      listener - is the listener instance
      See Also:
    • checkData

      protected void checkData(T data, String command, CalculatorLogger logger) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • getErrorMessage

      protected String getErrorMessage(List<CalculatorError> checkResults)
    • isLicensed

      public final boolean isLicensed()
      Description copied from interface: Licensable
      Checks if the required license is available for using this class or product.
      Specified by:
      isLicensed in interface Licensable
      Returns:
      true if this software component is correctly licensed
    • setLicenseEnvironment

      public final void setLicenseEnvironment(String env)
      Description copied from interface: Licensable
      Sets the current license environment identifier. For internal use only!
      Specified by:
      setLicenseEnvironment in interface Licensable
      Parameters:
      env - license environment. It is string identifier of a certain integration environment.
    • getProductName

      public abstract String getProductName()
      Returns the product identifier of the plugin.
    • checkLicense

      protected final void checkLicense() throws LicenseException
      Throws:
      LicenseException