L
- Any Leg
class.public class StrictLegsSequence<L extends Leg> extends Object implements LegsSequence<L>
LegsSequence
which does not accept simultaneous or overlapping legs.
Legs are considered to have closed boundaries.Leg
,
LegsSequence
Constructor and Description |
---|
StrictLegsSequence()
Create a new empty sequence.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(L leg) |
boolean |
addAll(Collection<? extends L> legs)
This
addAll(…) method is not supported, since it’s an optional operation as stated in
Collection.addAll(Collection) . |
void |
clear() |
L |
current(TimeStamped t)
Returns the current leg at the given date.
|
L |
first()
Returns the first element currently in this sequence.
|
L |
first(TimeStamped t)
Returns the first element after the given date.
|
AbsoluteDateInterval |
getTimeInterval()
Returns the time interval of the legs sequence.
|
LegsSequence<L> |
head(L toLeg)
Returns a new sequence from the beginning to the given element.
|
boolean |
isEmpty() |
boolean |
isEmpty(AbsoluteDate date,
AbsoluteDate end)
Checks whether the sequence is free on the given interval or not.
|
Iterator<L> |
iterator() |
L |
last()
Returns the last element currently in this sequence.
|
L |
last(TimeStamped t)
Returns the last element before the given date.
|
L |
next(L leg)
Returns the strictly next element.
|
L |
previous(L leg)
Returns the strictly previous element.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c)
This
addAll(…) method is not supported, since it’s an optional operation as stated in
Collection.retainAll(Collection) . |
Set<L> |
simultaneous(L leg)
Such a
StrictLegsSequence cannot have simultaneous legs! |
Set<L> |
simultaneous(TimeStamped t)
Such a
StrictLegsSequence cannot have simultaneous legs. |
int |
size() |
LegsSequence<L> |
sub(L fromLeg,
L toLeg)
Returns a new sequence extracted.
|
LegsSequence<L> |
tail(L fromLeg)
Returns a new sequence from the given element through the end.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toPrettyString
contains, containsAll
equals, hashCode, parallelStream, removeIf, spliterator, stream
public L current(TimeStamped t)
current
in interface LegsSequence<L extends Leg>
t
- A date from any TimeStamped
object.Leg
at the t
date, or null
if none.public L first()
first
in interface LegsSequence<L extends Leg>
first
in interface TimeSequence<L extends Leg>
Leg
, null
if none.public L last()
last
in interface LegsSequence<L extends Leg>
last
in interface TimeSequence<L extends Leg>
Leg
, null
if none.public L first(TimeStamped t)
See TimeSequence.next(TimeStamped)
for “strict” comparison.
first
in interface LegsSequence<L extends Leg>
first
in interface TimeSequence<L extends Leg>
t
- A date from any TimeStamped
object.Leg
starting after (or at) the given date t
.public L last(TimeStamped t)
See TimeSequence.previous(TimeStamped)
for “strict” comparison.
last
in interface LegsSequence<L extends Leg>
last
in interface TimeSequence<L extends Leg>
t
- A date from any TimeStamped
object.Leg
finishing before (or at) the given date t
.public Set<L> simultaneous(L leg)
StrictLegsSequence
cannot have simultaneous legs!simultaneous
in interface LegsSequence<L extends Leg>
leg
- A Leg
of this sequence.StrictLegsSequence
cannot have simultaneous legs, the returned Set
is a
HashSet
containing
just the given leg
.IllegalArgumentException
- If leg
is null or sequence is not empty and does not contain leg.LegsSequence.simultaneous(Leg)
public Set<L> simultaneous(TimeStamped t)
StrictLegsSequence
cannot have simultaneous legs.
Warning: legs are considered to have closed boundaries. For instance a sequence ]a, b[ U ]b, c[ and t = b will return the second leg although b is not in the sequence.
simultaneous
in interface TimeSequence<L extends Leg>
t
- Time value to match. Not necessarily an element contained in the sequence.t
, if any. (If t
is a leg of the sequence, it’s the returned one.)TimeSequence.simultaneous(TimeStamped)
public L previous(L leg)
previous
in interface LegsSequence<L extends Leg>
previous
in interface TimeSequence<L extends Leg>
leg
- Any element of this sequence.Leg
of the given leg
, null
if none.public L next(L leg)
next
in interface LegsSequence<L extends Leg>
next
in interface TimeSequence<L extends Leg>
leg
- Any element of this sequence.Leg
of the given leg
, null
if none.public LegsSequence<L> head(L toLeg)
head
in interface LegsSequence<L extends Leg>
head
in interface TimeSequence<L extends Leg>
toLeg
- Any element of this sequence.Sequence
object including all elements from the “beginning” to the given one (included).public LegsSequence<L> tail(L fromLeg)
tail
in interface LegsSequence<L extends Leg>
tail
in interface TimeSequence<L extends Leg>
fromLeg
- Any element of this sequence.Sequence
object including all elements from the given one (included) through the “end”.public LegsSequence<L> sub(L fromLeg, L toLeg)
sub
in interface LegsSequence<L extends Leg>
sub
in interface TimeSequence<L extends Leg>
fromLeg
- Any element of this sequence.toLeg
- Any element of this sequence.Sequence
object including all elements from the given one fromT
to the given one
toT
(both
included).public boolean isEmpty(AbsoluteDate date, AbsoluteDate end)
isEmpty
in interface LegsSequence<L extends Leg>
date
- The “beginning” date.end
- The “end” date.true
if this sequence is completely free during the given time interval.public boolean add(L leg)
add
in interface Collection<L extends Leg>
public boolean addAll(Collection<? extends L> legs)
addAll(…)
method is not supported, since it’s an optional operation as stated in
Collection.addAll(Collection)
.addAll
in interface Collection<L extends Leg>
public void clear()
clear
in interface Collection<L extends Leg>
public boolean isEmpty()
isEmpty
in interface Collection<L extends Leg>
public boolean remove(Object o)
remove
in interface Collection<L extends Leg>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<L extends Leg>
public boolean retainAll(Collection<?> c)
addAll(…)
method is not supported, since it’s an optional operation as stated in
Collection.retainAll(Collection)
.retainAll
in interface Collection<L extends Leg>
public int size()
size
in interface Collection<L extends Leg>
public Object[] toArray()
toArray
in interface Collection<L extends Leg>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<L extends Leg>
public AbsoluteDateInterval getTimeInterval()
Null is returned if the sequence is empty.
Warning: in case of sequences with holes, the sequence in the returned interval will not contain continuous data.
getTimeInterval
in interface LegsSequence<L extends Leg>
Copyright © 2021 CNES. All rights reserved.