IN
- The type of the samples to be interpolatedOUT
- The type of the interpolation result.public class TimeStampedInterpolableEphemeris<IN extends TimeStamped,OUT> extends Object implements Serializable
This class makes a difference between 3 interval types:
isAcceptOutOfOptimalRange()
, either to the samples interval
or to the optimal intervalModifier and Type | Class and Description |
---|---|
static class |
TimeStampedInterpolableEphemeris.SearchMethod
Enumerate to specify the search method used to find the correct samples interval given a certain date.
|
Constructor and Description |
---|
TimeStampedInterpolableEphemeris(IN[] samples,
int order,
TimeStampedInterpolationFunctionBuilder<IN,OUT> interpFctBuilder,
boolean acceptOutOfOptimalRange)
Simplified constructor.
By default, the given samples are copied to be stored, plus they are checked to be strictly sorted (in increasing order and no samples with the same date) and a cache size of FIFOThreadSafeCache.DEFAULT_MAX_SIZE is
used. |
TimeStampedInterpolableEphemeris(IN[] samples,
int order,
TimeStampedInterpolationFunctionBuilder<IN,OUT> interpFctBuilder,
boolean acceptOutOfOptimalRange,
boolean copySamples,
boolean checkStrictlySorted,
int cacheSize)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
TimeStampedInterpolableEphemeris<IN,OUT> |
extendInterpolableEphemeris(IN[] extraSamples,
boolean addOnTheRight,
boolean checkStrictlySorted)
Extend the current interpolable ephemeris with new samples while keeping the cache.
|
double |
getCacheReusabilityRatio()
Provides the ratio of reusability of the internal cache.
|
int |
getCeilingIndex(AbsoluteDate date)
Getter for the ceiling index for the given date.
If the provided date is after the last sample, -1 is returned. |
IN |
getCeilingSample(AbsoluteDate date)
Getter for the ceiling sample for the given date.
|
AbsoluteDate |
getFirstDate()
Getter for the first date.
|
AbsoluteDate |
getFirstOptimalDate()
Getter for the first optimal date.
|
IN |
getFirstSample()
Getter for the first sample.
|
AbsoluteDate |
getFirstUsableDate()
Getter for the first usable date.
|
int |
getFloorIndex(AbsoluteDate date)
Getter for the floor index for the given date.
If the provided date is before the first sample, -1 is returned. |
IN |
getFloorSample(AbsoluteDate date)
Getter for the floor sample for the given date.
|
AbsoluteDate |
getLastDate()
Getter for the last date.
|
AbsoluteDate |
getLastOptimalDate()
Getter for the last optimal date.
|
IN |
getLastSample()
Getter for the last sample.
|
AbsoluteDate |
getLastUsableDate()
Getter for the last usable date.
|
IN[] |
getSamples(boolean copy)
Getter for the samples array.
|
int |
getSampleSize()
Getter for the sample size.
|
TimeStampedInterpolableEphemeris.SearchMethod |
getSearchMethod()
Getter for the search method.
|
OUT |
interpolate(AbsoluteDate date)
Returns an interpolated instance at the required date.
|
boolean |
isAcceptOutOfOptimalRange()
Indicates whether accept dates outside of the optimal interval which is a sub-interval from the full interval
interval required for interpolation with respect to the interpolation order.
|
void |
setSearchMethod(TimeStampedInterpolableEphemeris.SearchMethod searchMethod)
Setter for the search method.
|
String |
toString() |
public TimeStampedInterpolableEphemeris(IN[] samples, int order, TimeStampedInterpolationFunctionBuilder<IN,OUT> interpFctBuilder, boolean acceptOutOfOptimalRange)
FIFOThreadSafeCache.DEFAULT_MAX_SIZE
is
used.
Note: The interpolation function builder has to implement Serializable
if the interpolable ephemeris
should be serializable (not required).
samples
- The array of samplesorder
- Interpolation order (number of points to use for the interpolation). It must be even.interpFctBuilder
- The function that can build an interpolation functionacceptOutOfOptimalRange
- Indicates whether accept dates outside of the optimal interval which is a sub-interval from the full
interval interval
required for interpolation with respect to the interpolation orderNullArgumentException
- if samples
is nullIllegalArgumentException
- if the samples aren't sorted
if the order isn't an even number or is lower than 2
if the interpolable ephemeris length is lower than the orderpublic TimeStampedInterpolableEphemeris(IN[] samples, int order, TimeStampedInterpolationFunctionBuilder<IN,OUT> interpFctBuilder, boolean acceptOutOfOptimalRange, boolean copySamples, boolean checkStrictlySorted, int cacheSize)
Note: The interpolation function builder has to implement Serializable
if the interpolable ephemeris
should be serializable (not required).
samples
- The array of samplesorder
- Interpolation order (number of points to use for the interpolation). It must be even.interpFctBuilder
- The function that can build an interpolation functionacceptOutOfOptimalRange
- Indicates whether accept dates outside of the optimal interval which is a sub-interval from the full
interval interval required for interpolation with respect to the interpolation ordercopySamples
- Indicates whether the given samples should be copied or stored directlycheckStrictlySorted
- Indicates whether the given samples should be checked to be strictly sorted (in increasing order and no
samples with the same date) or if it's not necessarycacheSize
- The size of the cache. 0 is a legitimate value emulating the absence of cache.NullArgumentException
- if samples
or interpolationFunctionBuilder
is nullIllegalArgumentException
- if the samples should be sorted (checkStrictlySorted = true
) and aren't
if the order is an odd number or is lower than 2
if the samples array length is lower than the orderNotPositiveException
- if cacheSize < 0
public TimeStampedInterpolableEphemeris<IN,OUT> extendInterpolableEphemeris(IN[] extraSamples, boolean addOnTheRight, boolean checkStrictlySorted)
Note: The current ephemeris should not be used anymore after being extended since it will share the same cache as the returned extended ephemeris.
extraSamples
- The extra sample to extend the ephemerisaddOnTheRight
- Indicate if the samples should be added on the right (after) or on the left (before) the existing samplescheckStrictlySorted
- Indicate if the extraSample should be checked to be strictly increasingly sorted.
Should be deactivated only if it is guaranteed by the user.IllegalArgumentException
- if the extra samples dates are not coherent with respect to the addOnTheRight
boolean
or if the extra samples are not strictly sorted (while checkStrictlySorted
is activated)public OUT interpolate(AbsoluteDate date)
date
- The date of the interpolationIllegalStateException
- if the date is outside the supported interval
or if the instance has the setting acceptOutOfRange = false
and the date is outside the optimal
interval which is a sub-interval from the full interval interval required for interpolation with respect
to the interpolation orderpublic int getFloorIndex(AbsoluteDate date)
date
- The date to look forpublic int getCeilingIndex(AbsoluteDate date)
date
- The date to look forpublic IN getFloorSample(AbsoluteDate date)
date
- The date to look forIllegalStateException
- if the provided date is before the first samplepublic IN getCeilingSample(AbsoluteDate date)
date
- The date to look forIllegalStateException
- if the provided date is after the last samplepublic final IN getFirstSample()
public final IN getLastSample()
public final AbsoluteDate getFirstDate()
public final AbsoluteDate getLastDate()
public AbsoluteDate getFirstUsableDate()
public AbsoluteDate getLastUsableDate()
public final AbsoluteDate getFirstOptimalDate()
public final AbsoluteDate getLastOptimalDate()
public int getSampleSize()
public IN[] getSamples(boolean copy)
copy
- if true
return a copy of the samples array, otherwise return the stored arraypublic double getCacheReusabilityRatio()
public boolean isAcceptOutOfOptimalRange()
true
if the dates outside of the optimal interval are accepted, false
otherwisepublic TimeStampedInterpolableEphemeris.SearchMethod getSearchMethod()
public void setSearchMethod(TimeStampedInterpolableEphemeris.SearchMethod searchMethod)
searchMethod
- the search method to setNullArgumentException
- if searchMethod
is nullCopyright © 2023 CNES. All rights reserved.