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() |
StrictLegsSequence<L> |
copy()
Returns a copy of the sequence.
|
StrictLegsSequence<L> |
copy(AbsoluteDateInterval newInterval)
Creates a new legs sequence from this one.
|
StrictLegsSequence<L> |
copy(AbsoluteDateInterval newInterval,
boolean strict)
Creates a new legs sequence from this one.
|
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.
|
NavigableSet<TimeStamped> |
getSet()
Getter
|
AbsoluteDateInterval |
getTimeInterval()
Returns the time interval of the legs sequence.
|
LegsSequence<L> |
head(AbsoluteDate toT,
boolean strict)
Returns a new sequence from the beginning to the given element.
|
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(AbsoluteDate fromT,
AbsoluteDate toT,
boolean strict)
Returns a new sequence extracted.
|
LegsSequence<L> |
sub(AbsoluteDateInterval interval,
boolean strict)
Returns a new sequence extracted.
|
LegsSequence<L> |
sub(L fromLeg,
L toLeg)
Returns a new sequence extracted.
|
LegsSequence<L> |
tail(AbsoluteDate fromT,
boolean strict)
Returns a new sequence from the given element to the end of the sequence.
|
LegsSequence<L> |
tail(L fromLeg)
Returns a new sequence from the given element through the end.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toPrettyString() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
head, sub, sub, tail
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> head(AbsoluteDate toT, boolean strict)
head
in interface LegsSequence<L extends Leg>
toT
- Any element of this sequence.strict
- true if boundary shall not be included in the extracted sequence, false otherwise.Sequence
object including all elements from the “beginning” to the
given one (included only
if strict
= false).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> tail(AbsoluteDate fromT, boolean strict)
tail
in interface LegsSequence<L extends Leg>
fromT
- Any element of this sequence.strict
- true if boundary shall not be included in the extracted sequence, false otherwise.Sequence
object including all elements from the given one (included
only
if strict
= false) to the “end” of the sequence.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 LegsSequence<L> sub(AbsoluteDate fromT, AbsoluteDate toT, boolean strict)
sub
in interface LegsSequence<L extends Leg>
fromT
- Any element of this sequence.toT
- Any element of this sequence.strict
- true if boundaries shall not be included in the extracted sequence, false otherwise.Sequence
object including all elements from the given one fromT
to the given one.
Elements exactly on the interval boundaries are included only if strict
=
false.public LegsSequence<L> sub(AbsoluteDateInterval interval, boolean strict)
sub
in interface LegsSequence<L extends Leg>
interval
- interval.strict
- true if boundaries shall not be included in the extracted sequence, false otherwise.Sequence
object including all elements included in the interval
.
Elements exactly on the interval boundaries are included only if strict
=
false.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 String toPrettyString()
toPrettyString
in interface LegsSequence<L extends Leg>
toPrettyString
in interface TimeSequence<L extends Leg>
String
representation.public String toString()
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>
public StrictLegsSequence<L> copy()
copy
in interface LegsSequence<L extends Leg>
copy
in interface TimeSequence<L extends Leg>
public StrictLegsSequence<L> copy(AbsoluteDateInterval newInterval, boolean strict)
copy
in interface LegsSequence<L extends Leg>
newInterval
- The time interval of the legs sequence to createstrict
- true if boundaries shall not be included in the new sequence, false otherwise.LegsSequence
valid on provided intervalpublic StrictLegsSequence<L> copy(AbsoluteDateInterval newInterval)
copy
in interface LegsSequence<L extends Leg>
newInterval
- The time interval of the legs sequence to createLegsSequence
valid on provided interval. Boundaries are not included in
the new sequence.public NavigableSet<TimeStamped> getSet()
Copyright © 2023 CNES. All rights reserved.