T - The type of the objectspublic class IntervalMapSearcher<T> extends Object implements Iterable<CacheEntry<AbsoluteDateInterval,T>>, Serializable
AbsoluteDateInterval. It allows to get efficiently the object corresponding
to a given date.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE
Default cache size.
|
| Constructor and Description |
|---|
IntervalMapSearcher(Collection<AbsoluteDateInterval> intervalsCollection,
Collection<T> objectsCollection)
Simple constructor with a collection of
intervals and a collection of objects. |
IntervalMapSearcher(Collection<AbsoluteDateInterval> intervalsCollection,
Collection<T> objectsCollection,
int cacheSize)
Simple constructor with a collection of
intervals and a collection of objects. |
IntervalMapSearcher(Map<AbsoluteDateInterval,T> map)
Main constructor.
|
IntervalMapSearcher(Map<AbsoluteDateInterval,T> map,
int cacheSize)
Main constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsData(AbsoluteDate date)
Check if the provided date belongs to any available interval.
|
List<T> |
getData()
Getter for the data associated to the
intervals. |
T |
getData(AbsoluteDate date)
Getter for the object associated to the provided date.
|
T |
getData(AbsoluteDate date,
boolean throwException)
Getter for the object associated to the provided date.
|
AbsoluteDateInterval |
getFirstInterval()
Getter for the first interval.
|
Map<AbsoluteDateInterval,T> |
getIntervalDataAssociation()
Getter for the association between
intervals and data. |
AbsoluteDateIntervalsList |
getIntervals()
Getter for the available intervals.
|
AbsoluteDateInterval |
getLastInterval()
Getter for the last interval.
|
Iterator<CacheEntry<AbsoluteDateInterval,T>> |
iterator()
Return an iterator over entries associating an object and an interval.
|
int |
size()
Return the number of elements.
|
CacheEntry<AbsoluteDateInterval,T>[] |
toArray()
Transform into an array of entries.
|
CacheEntry<AbsoluteDateInterval,T>[] |
toArray(boolean copy)
Transform into an array of entries.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final int DEFAULT_CACHE_SIZE
public IntervalMapSearcher(Collection<AbsoluteDateInterval> intervalsCollection, Collection<T> objectsCollection)
intervals and a collection of objects.
Both collections should be the same size and their iterator should coherently go through the data.
The intervals must not overlap with each other.
intervalsCollection - Collection of intervalsobjectsCollection - Collection of objectsDimensionMismatchException - if intervalsCollection.size() != objectsCollection.size()IllegalArgumentException - if some intervals from the specified collection overlap with each other
if one of the objects of the objects collection is nullpublic IntervalMapSearcher(Collection<AbsoluteDateInterval> intervalsCollection, Collection<T> objectsCollection, int cacheSize)
intervals and a collection of objects.
Both collections should be the same size and their iterator should coherently go through the data.
The intervals must not overlap with each other.
intervalsCollection - Collection of intervalsobjectsCollection - Collection of objectscacheSize - Size of the cacheDimensionMismatchException - if intervalsCollection.size() != objectsCollection.size()IllegalArgumentException - if some intervals from the specified collection overlap with each other
if one of the objects of the objects collection is nullpublic IntervalMapSearcher(Map<AbsoluteDateInterval,T> map)
map - Map of intervals and functions. Note that the map is not duplicated internally.IllegalArgumentException - if some intervals from the specified map overlap with each other
if one of the objects of the map is nullNullArgumentException - if map is nullpublic IntervalMapSearcher(Map<AbsoluteDateInterval,T> map, int cacheSize)
map - Map of intervals and functions. Note that the map is not duplicated internally.cacheSize - Size of the cacheIllegalArgumentException - if some intervals from the specified map overlap with each other
if one of the objects of the map is nullNullArgumentException - if map is nullpublic boolean containsData(AbsoluteDate date)
date - Date to checktrue if the date belongs to an available intervalpublic AbsoluteDateInterval getFirstInterval()
public AbsoluteDateInterval getLastInterval()
public AbsoluteDateIntervalsList getIntervals()
public Map<AbsoluteDateInterval,T> getIntervalDataAssociation()
intervals and data.public T getData(AbsoluteDate date)
date - Date associated to the objectIllegalStateException - if the provided date does not belong to any of the intervalspublic T getData(AbsoluteDate date, boolean throwException)
date - Date associated to the objectthrowException - Indicate if the method should throw an exception if the provided date does not belong to any of the
intervalsIllegalStateException - if throwException == true and the provided date does not belong to any of the intervalspublic Iterator<CacheEntry<AbsoluteDateInterval,T>> iterator()
iterator in interface Iterable<CacheEntry<AbsoluteDateInterval,T>>public int size()
public CacheEntry<AbsoluteDateInterval,T>[] toArray(boolean copy)
copy - Copy the internal arraypublic CacheEntry<AbsoluteDateInterval,T>[] toArray()
Copyright © 2024 CNES. All rights reserved.