Class CalibrationTable
- java.lang.Object
-
- org.palladiosimulator.protocom.resourcestrategies.activeresource.CalibrationTable
-
public class CalibrationTable extends Object
Class representing the calibration table. Stores a collection of calibration entries.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CALIBRATION_TABLE_SIZEDefault number of tuplesto store in the calibration table protected org.palladiosimulator.protocom.resourcestrategies.activeresource.CalibrationEntry[]table
-
Constructor Summary
Constructors Constructor Description CalibrationTable()Private constructor.CalibrationTable(int tableSize)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEntry(int entryNumber, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> targetTime, long parameter)Creates a new calibration entry.static CalibrationTablefromBinary(byte[] binary)Creates a calibration table from a byte array.org.palladiosimulator.protocom.resourcestrategies.activeresource.CalibrationEntrygetEntry(int entryNumber)Returns the calibration entry for given number.static CalibrationTableload(File configFile)Loads calibration from config filevoidsave(File configFile)Saves calibration to config file.intsize()Returns the size of the calibration table.byte[]toBinary()Serializes the calibration table to a byte array.
-
-
-
Field Detail
-
DEFAULT_CALIBRATION_TABLE_SIZE
public static final int DEFAULT_CALIBRATION_TABLE_SIZE
Default number of tuplesto store in the calibration table - See Also:
- Constant Field Values
-
table
protected org.palladiosimulator.protocom.resourcestrategies.activeresource.CalibrationEntry[] table
-
-
Constructor Detail
-
CalibrationTable
public CalibrationTable()
Private constructor. Used when created by loading an existing calibration table.
-
CalibrationTable
public CalibrationTable(int tableSize)
Constructor. New calibration table with given size.- Parameters:
tableSize- size of the calibration table
-
-
Method Detail
-
load
public static CalibrationTable load(File configFile)
Loads calibration from config file- Returns:
- The loaded calibration file or null if the file could not be loaded
-
save
public void save(File configFile)
Saves calibration to config file. Config file uses a Java object stream to serialise the calibration table.
-
toBinary
public byte[] toBinary()
Serializes the calibration table to a byte array.- Returns:
- a byte array containing the serialized calibration table
-
fromBinary
public static CalibrationTable fromBinary(byte[] binary)
Creates a calibration table from a byte array.- Parameters:
binary- a byte array containing the serialized calibration table- Returns:
- a new CalibrationTable object
-
getEntry
public org.palladiosimulator.protocom.resourcestrategies.activeresource.CalibrationEntry getEntry(int entryNumber)
Returns the calibration entry for given number.- Parameters:
entryNumber-- Returns:
-
addEntry
public void addEntry(int entryNumber, org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> targetTime, long parameter)Creates a new calibration entry.- Parameters:
entryNumber- entry number (position in table)targetTime-parameter-
-
size
public int size()
Returns the size of the calibration table.- Returns:
-
-