T
- Any TimeStamped
class.public interface TimeSequence<T extends TimeStamped> extends Collection<T>
Collection
of TimeStamped
objects.
This sequence is designed to sort objects by their date (TimeStamped.getDate()
). Some might suggest that a
NavigableSet
would have done the job, but a NavigableSet
has some methods too complicated and too
ambiguous to implement (as lower()
, floor()
, …) with “time-sorted” objects.
Besides, as stated in the SortedSet
interface documentation, the used Comparator
must be
“consistent with equals”, and it cannot be achieved with such TimeStamped
objects.
TimeStamped
,
LegsSequence
Modifier and Type | Method and Description |
---|---|
default boolean |
contains(Object o) |
default boolean |
containsAll(Collection<?> c) |
TimeSequence<T> |
copy()
Returns a copy of the sequence.
|
T |
first()
Returns the first element currently in this sequence.
|
T |
first(TimeStamped t)
Returns the first element after the given date.
|
TimeSequence<T> |
head(T toT)
Returns a new sequence from the beginning to the given element.
|
T |
last()
Returns the last element currently in this sequence.
|
T |
last(TimeStamped t)
Returns the last element before the given date.
|
T |
next(T t)
Returns the strictly next element.
|
T |
previous(T t)
Returns the strictly previous element.
|
Set<T> |
simultaneous(TimeStamped t)
Returns all simultaneous elements.
|
TimeSequence<T> |
sub(T fromT,
T toT)
Returns a new sequence extracted.
|
TimeSequence<T> |
tail(T fromT)
Returns a new sequence from the given element through the end.
|
default String |
toPrettyString() |
T first()
T last()
T first(TimeStamped t)
See next(TimeStamped)
for “strict” comparison.
t
- A date from any TimeStamped
object.t
.T last(TimeStamped t)
See previous(TimeStamped)
for “strict” comparison.
t
- A date from any TimeStamped
object.t
.Set<T> simultaneous(TimeStamped t)
t
- Time value to match. Not necessarily an element contained in the sequence.t
. If t
is an element of the sequence, it’s among the returned
elements.T previous(T t)
t
- Any element of this sequence.null
if none. It’s a strictly previous: its date is
strictly lower.
Note also there may be simultaneous elements…T next(T t)
t
- Any element of this sequence.null
if none. It’s a strictly next: its date is
strictly upper. Note
also there may be simultaneous elements…TimeSequence<T> head(T toT)
toT
- Any element of this sequence.Sequence
object including all elements from the “beginning” to the given one (included).TimeSequence<T> tail(T fromT)
fromT
- Any element of this sequence.Sequence
object including all elements from the given one (included) through the “end”.TimeSequence<T> sub(T fromT, T toT)
fromT
- Any element of this sequence.toT
- Any element of this sequence.Sequence
object including all elements from the given one fromT
to the given one
toT
(both included).default boolean contains(Object o)
contains
in interface Collection<T extends TimeStamped>
default boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T extends TimeStamped>
default String toPrettyString()
String
representation.TimeSequence<T> copy()
Copyright © 2023 CNES. All rights reserved.