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
  • Field Summary

    Fields inherited from class java.util.AbstractList

    modCount
  • Constructor Summary

    Constructors
    Constructor Description
    GtiList()
    Create an empty GTI List
  • Method Summary

    Modifier and Type Method Description
    void add​(long start, long end)
    Convenience method to add a new GTI
    void and​(GtiList list)
    combine list with second list (logical AND) Return this List combined with second list
    double getOntime()
    Compute the sum of the TimeIntervals
    Gti inside​(long time)
    Check if a time is within any GTI in the list
    boolean 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()-1
    java.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

    Methods inherited from class java.util.AbstractCollection

    containsAll

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, stream, toArray

    Methods inherited from interface java.util.List

    containsAll
  • Constructor Details

    • GtiList

      public GtiList()
      Create an empty GTI List
  • Method Details

    • add

      public void add​(long start, long end) throws java.lang.RuntimeException
      Convenience method to add a new GTI
      Parameters:
      start - T
      end - 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 class java.util.AbstractCollection<Gti>
      Returns:
      String