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 void
add(long start, long end)
Convenience method to add a new GTIvoid
and(GtiList list)
combine list with second list (logical AND) Return this List combined with second listdouble
getOntime()
Compute the sum of the TimeIntervalsGti
inside(long time)
Check if a time is within any GTI in the listboolean
isReduced()
Is the list reduced?boolean
isSorted()
Is the list sorted?void
or(GtiList list)
combine list with second list (logical OR)void
reduce()
Combine overlapping intervals (logical OR)void
sortIt()
sort the list such that t_i_start <= t_i+1_start forall i=0, this->size()-1java.lang.String
toString()
-
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.RuntimeException
Convenience 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.RuntimeException
Combine 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:
toString
in classjava.util.AbstractCollection<Gti>
- Returns:
- String
-
-