Interface IDemandStrategy
- All Known Implementing Classes:
AbstractDemandStrategy
,CalculatePrimesDemand
,CountNumbersDemand
,FFTDemand
,FibonacciDemand
,MandelbrotDemand
,ReadLargeChunksDemand
,SortArrayDemand
,VoidDemand
,WaitDemand
public interface IDemandStrategy
-
Method Summary
Modifier and TypeMethodDescriptionCalibrates the strategy and sets the internal calibration table.void
cleanup()
Do cleanup work.void
consume
(double demand) Consume a resource according to its demand & processing rate(specified in initaliseStrategy) WARNING: initializeStrategy() has to be run firstboolean
Checks whether debug mode is enabled.void
getName()
Gets the name of the strategy.Get the resource this strategy is able to simulateboolean
Checks whether the strategy has a calibration table.void
initializeStrategy
(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate) Initialize the strategy and perform necessary calibrationsvoid
initializeStrategy
(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath) Initialize the strategy and perform necessary calibrationsvoid
setCalibrationListener
(ICalibrationListener listener) Sets the calibration listener that receives progress updates during the calibration.void
Sets the calibration table.void
setDebug
(boolean enable) Enables or disables debug mode.void
setProperties
(Properties properties) Do not use default properties, but set properties externally.
-
Method Details
-
initializeStrategy
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 timeprocessingRate
- [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 timeprocessingRate
- [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
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
Sets the calibration listener that receives progress updates during the calibration.- Parameters:
listener
- the calibration listener to receive the updates
-
setCalibrationTable
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()
-