Class GtiList
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<Gti>, Collection<Gti>, List<Gti>, RandomAccess, SequencedCollection<Gti>
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long start, long end) Convenience method to add a new GTIvoidcombine list with second list (logical AND) Return this List combined with second listdoubleCompute the sum of the TimeIntervalsinside(long time) Check if a time is within any GTI in the listbooleanIs the list reduced?booleanisSorted()Is the list sorted?voidcombine 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()-1toString()Methods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAllMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Constructor Details
-
GtiList
public GtiList()Create an empty GTI List
-
-
Method Details
-
add
Convenience method to add a new GTI- Parameters:
start- Tend- T- Throws:
RuntimeException
-
inside
Check if a time is within any GTI in the list- Parameters:
time- time to find- Returns:
- first GTI object in which 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
combine list with second list (logical or)+----------------+ gti 1 ( +-----------+ gti 2 || \/ +-------------------+ combined
- Parameters:
list- list to combine with- Throws:
RuntimeException
-
and
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:
RuntimeException
-
reduce
Combine overlapping intervals (logical OR)+----------------+ Gti 1 +-----------+ Gti 2 || \/ +-------------------+ combined
- Throws:
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
- Overrides:
toStringin classAbstractCollection<Gti>- Returns:
- String
-