public class Interpolation extends java.lang.Object implements Rollbackable
The setValues() method specifies the reference values as a double array. setIndexes() specifies the indexes of those values as an int array. These two arrays must have the same length, and the indexes must be increasing and non-negative; otherwise an exception will be thrown. The values are periodic if a positive period is set by setPeriod(). In this case, the period must be greater than the largest index, and values within the index range 0 to (period-1) are repeated indefinitely. If the period is zero, the values are not periodic, and the values outside the range of the indexes are considered to be 0.0. The interpolation order is set by setOrder().
The default reference values are {1.0, 0.0} and the indexes are {0, 1}. The default period is 2 and the order is 0.
Modifier and Type | Field and Description |
---|---|
protected Checkpoint |
$CHECKPOINT |
protected CheckpointRecord |
$RECORD$$CHECKPOINT |
Constructor and Description |
---|
Interpolation()
Construct an instance of Interpolation using the default parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes
made at timestamp and afterward.
|
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object.
|
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable
object.
|
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object.
|
int[] |
getIndexes()
Return the reference indexes.
|
int |
getOrder()
Return the interpolation order.
|
int |
getPeriod()
Return the value repetition period.
|
double[] |
getValues()
Return the reference values.
|
double |
interpolate(int index)
Return the interpolation result for the specified index.
|
void |
setIndexes(int[] indexes)
Set the reference indexes.
|
void |
setOrder(int order)
Set the interpolation order.
|
void |
setPeriod(int period)
Set the value repetition period.
|
void |
setValues(double[] values)
Set the reference values.
|
protected transient Checkpoint $CHECKPOINT
protected transient CheckpointRecord $RECORD$$CHECKPOINT
public Interpolation()
public int[] getIndexes()
setIndexes(int[])
public int getOrder()
setOrder(int)
public int getPeriod()
setPeriod(int)
public double[] getValues()
setValues(double[])
public double interpolate(int index)
index
- The point of interpolation. Can be negativejava.lang.IllegalStateException
- If the index and value arrays
do not have the same length, or the period is not 0 and not
greater than the largest index.public void setIndexes(int[] indexes)
indexes
- An int array.java.lang.IllegalArgumentException
- If the argument array is
not increasing and non-negative.getIndexes()
public void setOrder(int order)
order
- An int.java.lang.IllegalArgumentException
- If the order is not 0, 1, or 3.getOrder()
public void setPeriod(int period)
period
- An int.java.lang.IllegalArgumentException
- If the period is negative.getPeriod()
public void setValues(double[] values)
values
- A double array.getValues()
public void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
timestamp
- The timestamp.public void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
public final Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Rollbackable
public final java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Rollbackable
checkpoint
- The new checkpoint object.Checkpoint.setCheckpoint(Checkpoint)