All Known Implementing Classes:
AbstractDemandStrategy, CalculatePrimesDemand, CountNumbersDemand, FFTDemand, FibonacciDemand, MandelbrotDemand, ReadLargeChunksDemand, SortArrayDemand, VoidDemand, WaitDemand

public interface IDemandStrategy
  • Method Details

    • initializeStrategy

      void initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate)
      Initialize the strategy and perform necessary calibrations
      Parameters:
      degreeOfAccuracy - The degree of accuracy used for calibration: HIGH, MEDIUM, LOW WARNING: The use of HIGH can result in a significant increase in the execution time
      processingRate - [units/seconds] The rate to initialize with (demand/processingRate = time)
    • initializeStrategy

      void initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath)
      Initialize the strategy and perform necessary calibrations
      Parameters:
      degreeOfAccuracy - The degree of accuracy used for calibration: HIGH, MEDIUM, LOW WARNING: The use of HIGH can result in a significant increase in the execution time
      processingRate - [units/seconds] The rate to initialize with (demand/processingRate = time)
      calibrationPath - Path where the calibration is stored
    • consume

      void consume(double demand)
      Consume a resource according to its demand & processing rate(specified in initaliseStrategy) WARNING: initializeStrategy() has to be run first
      Parameters:
      demand - [units] The demand to consume
    • setProperties

      void setProperties(Properties properties)
      Do not use default properties, but set properties externally.
      Parameters:
      properties -
    • getStrategysResource

      ResourceTypeEnum getStrategysResource()
      Get the resource this strategy is able to simulate
      Returns:
      The resource type we can simulate
    • getName

      String getName()
      Gets the name of the strategy.
      Returns:
      a string containing the name of the strategy
    • setCalibrationListener

      void setCalibrationListener(ICalibrationListener listener)
      Sets the calibration listener that receives progress updates during the calibration.
      Parameters:
      listener - the calibration listener to receive the updates
    • setCalibrationTable

      void setCalibrationTable(CalibrationTable table)
      Sets the calibration table.
      Parameters:
      table - the calibration table
    • hasCalibrationTable

      boolean hasCalibrationTable()
      Checks whether the strategy has a calibration table.
      Returns:
      true if the strategy has a calibration table, otherwise false
    • calibrate

      CalibrationTable calibrate()
      Calibrates the strategy and sets the internal calibration table.
      Returns:
      a calibration table containing the results of the calibration
    • setDebug

      void setDebug(boolean enable)
      Enables or disables debug mode. When debug mode is enabled, the calibration returns dummy results instead of actually calibrating the strategy.
      Parameters:
      enable - true if debug mode should be enabled, otherwise false
    • debugEnabled

      boolean debugEnabled()
      Checks whether debug mode is enabled.
      Returns:
      true if debug mode is enabled, otherwise false
    • cleanup

      void cleanup()
      Do cleanup work.
    • ensureCalibrationExists

      void ensureCalibrationExists()