Package gaiasky.util.gaia.time
Class GtiList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<Gti>
-
- gaiasky.util.gaia.time.GtiList
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<Gti>,java.util.Collection<Gti>,java.util.List<Gti>,java.util.RandomAccess
public class GtiList extends java.util.ArrayList<Gti>
A collection of Good Time Intervals (GTIs).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GtiList()Create an empty GTI List
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long start, long end)Convenience method to add a new GTIvoidand(GtiList list)combine list with second list (logical AND) Return this List combined with second listdoublegetOntime()Compute the sum of the TimeIntervalsGtiinside(long time)Check if a time is within any GTI in the listbooleanisReduced()Is the list reduced?booleanisSorted()Is the list sorted?voidor(GtiList list)combine list with second list (logical OR)voidreduce()Combine overlapping intervals (logical OR)voidsortIt()sort the list such that t_i_start <= t_i+1_start forall i=0, this->size()-1java.lang.StringtoString()-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Method Detail
-
add
public void add(long start, long end) throws java.lang.RuntimeExceptionConvenience method to add a new GTI- Parameters:
start- Tend- T- Throws:
java.lang.RuntimeException
-
inside
public Gti inside(long time)
Check if a time is within any GTI in the list- Parameters:
time- time to find- Returns:
- first GTI object in which the time the time is found, null otherwise
-
sortIt
public void sortIt()
sort the list such that t_i_start <= t_i+1_start forall i=0, this->size()-1
-
or
public void or(GtiList list) throws java.lang.RuntimeException
combine list with second list (logical OR)+----------------+ Gti 1 ( +-----------+ Gti 2 || \/ +-------------------+ combined- Parameters:
list- List to combine with- Throws:
java.lang.RuntimeException
-
and
public void and(GtiList list) throws java.lang.RuntimeException
combine list with second list (logical AND) Return this List combined with second list+----------------+ Gti 1 +-----------+ Gti 2 || \/ +-------+ combined- Parameters:
list- List to combine with- Throws:
java.lang.RuntimeException
-
reduce
public void reduce() throws java.lang.RuntimeExceptionCombine overlapping intervals (logical OR)+----------------+ Gti 1 +-----------+ Gti 2 || \/ +-------------------+ combined- Throws:
java.lang.RuntimeException
-
getOntime
public double getOntime()
Compute the sum of the TimeIntervals- Returns:
- sum of all GTI durations [s]
-
isSorted
public boolean isSorted()
Is the list sorted?- Returns:
- true if the list sorted, false otherwise
-
isReduced
public boolean isReduced()
Is the list reduced?- Returns:
- true if the list reduced, false otherwise
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection<Gti>- Returns:
- String
-
-