Interface FieldTimeStampedCache<T extends FieldTimeStamped<KK>,KK extends CalculusFieldElement<KK>>
-
- Type Parameters:
T
- the type of dataKK
- type of the field element
- All Known Implementing Classes:
ImmutableFieldTimeStampedCache
public interface FieldTimeStampedCache<T extends FieldTimeStamped<KK>,KK extends CalculusFieldElement<KK>>
Interface for a data structure that can provide concurrent access toFieldTimeStamped
data surrounding a given date.- Author:
- Luc Maisonobe, Evan Ward, Vincent Cucchietti
- See Also:
ImmutableFieldTimeStampedCache
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
getEarliest()
Get the earliest entry in this cache.T
getLatest()
Get the latest entry in this cache.int
getMaxNeighborsSize()
Get the fixed size of the lists returned bygetNeighbors(FieldAbsoluteDate)
.default Stream<T>
getNeighbors(FieldAbsoluteDate<KK> central)
Get the entries surrounding a central date.Stream<T>
getNeighbors(FieldAbsoluteDate<KK> central, int n)
Get the entries surrounding a central date.
-
-
-
Method Detail
-
getNeighbors
default Stream<T> getNeighbors(FieldAbsoluteDate<KK> central)
Get the entries surrounding a central date.If the central date is well within covered range, the returned array will be balanced with half the points before central date and half the points after it (depending on n parity, of course). If the central date is near the boundary, then the returned array will be unbalanced and will contain only the n earliest (or latest) entries. A typical example of the later case is leap seconds cache, since the number of leap seconds cannot be arbitrarily increased.
This method is safe for multiple threads to execute concurrently.
- Parameters:
central
- central date- Returns:
- list of cached entries surrounding the specified date. The size of the list is guaranteed to be
getMaxNeighborsSize()
.
-
getNeighbors
Stream<T> getNeighbors(FieldAbsoluteDate<KK> central, int n)
Get the entries surrounding a central date.If the central date is well within covered range, the returned array will be balanced with half the points before central date and half the points after it (depending on n parity, of course). If the central date is near the boundary, then the returned array will be unbalanced and will contain only the n earliest (or latest) entries. A typical example of the later case is leap seconds cache, since the number of leap seconds cannot be arbitrarily increased.
This method is safe for multiple threads to execute concurrently.
- Parameters:
central
- central daten
- number of neighbors (cannot exceedgetMaxNeighborsSize()
)- Returns:
- list of cached entries surrounding the specified date. The size of the list is guaranteed to be
getMaxNeighborsSize()
. - Since:
- 12.1
-
getMaxNeighborsSize
int getMaxNeighborsSize()
Get the fixed size of the lists returned bygetNeighbors(FieldAbsoluteDate)
.- Returns:
- size of the list
-
getEarliest
T getEarliest() throws IllegalStateException
Get the earliest entry in this cache.- Returns:
- earliest cached entry
- Throws:
IllegalStateException
- if this cache is empty
-
getLatest
T getLatest() throws IllegalStateException
Get the latest entry in this cache.- Returns:
- latest cached entry
- Throws:
IllegalStateException
- if this cache is empty
-
-