Interface ICalculatedValueCache

All Known Implementing Classes:
CalculatedValueCache

public interface ICalculatedValueCache
Interface for specifying a value cache to support value calculations in a background thread.
Since:
1.3
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the internal cache.
    void
    Cleaning up internal resources like shutting down the ExecutorService.
    getCalculatedValue(int columnPosition, int rowPosition, boolean calculateInBackground, ICalculator calculator)
    Returns the calculated value for the specified column and row position.
    getCalculatedValue(int columnPosition, int rowPosition, ICalculatedValueCacheKey key, boolean calculateInBackground, ICalculator calculator)
    Returns the calculated value for the specified column and row position.
    void
    Kills all cached values.
    void
    Set the layer that should be used by this CalculatedValueCache to trigger updates after the calculation processing is done.
  • Method Details

    • getCalculatedValue

      Object getCalculatedValue(int columnPosition, int rowPosition, boolean calculateInBackground, ICalculator calculator)
      Returns the calculated value for the specified column and row position. If there is no calculated value for that coordinates in the cache or there is a potentially stale value, the re-calculation of the value is executed.

      This method tries to use a predefined cache key dependent on the configuration of this CalculatedValueCache.

      Parameters:
      columnPosition - The column position of the requested value.
      rowPosition - The row position of the requested value.
      calculateInBackground - Flag to specify whether the value calculation should be processed in the background or not. Setting this value to false will cause calculation in the UI thread, which is usually necessary in case of exporting and printing.
      calculator - The ICalculator that is used for calculating the values.
      Returns:
      The value for the given coordinates.
      Throws:
      IllegalStateException - if this CalculatedValueCache is configured to not use the column and row position for cache key definition.
    • getCalculatedValue

      Object getCalculatedValue(int columnPosition, int rowPosition, ICalculatedValueCacheKey key, boolean calculateInBackground, ICalculator calculator)
      Returns the calculated value for the specified column and row position. If there is no calculated value for that coordinates in the cache or there is a potentially stale value, the re-calculation of the value is executed.

      This method uses the given ICalculatedValueCacheKey instead of determining the cache key out of the CalculatedValueCache key configuration.

      Parameters:
      columnPosition - The column position of the requested value.
      rowPosition - The row position of the requested value.
      key - The key that is used by this CalculatedValueCache.
      calculateInBackground - Flag to specify whether the value calculation should be processed in the background or not. Setting this value to false will cause calculation in the UI thread, which is usually necessary in case of exporting and printing.
      calculator - The ICalculator that is used for calculating the values.
      Returns:
      The value for the given coordinates.
    • clearCache

      void clearCache()
      Clear the internal cache. Doing this will result in triggering new calculations. If the values where calculated before, using the cache copy still the already calculated values will be returned until the new calculation is done.
    • killCache

      void killCache()
      Kills all cached values. The internal cache aswell as the cache copy to support smooth updates of values. This is necessary because on structural changes, e.g. deleting/adding rows, the cache copy would return false values.
    • dispose

      void dispose()
      Cleaning up internal resources like shutting down the ExecutorService.
    • setLayer

      void setLayer(ILayer layer)
      Set the layer that should be used by this CalculatedValueCache to trigger updates after the calculation processing is done. Necessary if the caching is connected to a data provider for example, which is not able to fire events itself.
      Parameters:
      layer - The ILayer that should be used to fire the CellVisualChangeEvent after the background calculation process is done.