Package edu.cnu.mdi.splot.pdata
Class DataList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Double>,Collection<Double>,List<Double>,RandomAccess
- Direct Known Subclasses:
DataColumn
Named list of
Double values with cached min/max tracking.
Min/max are updated incrementally on add(Double) for speed. If
values are removed or replaced, min/max are recomputed as needed to remain
correct.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends Double> c) booleanaddAll(Collection<? extends Double> c) voidclear()doublegetMax()Get the maximum value in the column.doublegetMin()Get the minimum value in the column.protected voidRecompute min/max by scanning current contents.remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanprotected voidremoveRange(int fromIndex, int toIndex) voidreplaceAll(UnaryOperator<Double> operator) booleanretainAll(Collection<?> c) double[]values()Get the values as a primitive array.Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
DataList
public DataList()Create a data list with the given name.
-
-
Method Details
-
add
-
add
-
addAll
-
addAll
-
remove
-
remove
-
clear
public void clear() -
set
-
removeAll
-
retainAll
-
removeIf
-
replaceAll
- Specified by:
replaceAllin interfaceList<Double>- Overrides:
replaceAllin classArrayList<Double>
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRangein classArrayList<Double>
-
getMin
public double getMin()Get the minimum value in the column.- Returns:
- the minimum value, or +infinity if empty
-
getMax
public double getMax()Get the maximum value in the column.- Returns:
- the maximum value, or -infinity if empty
-
values
public double[] values()Get the values as a primitive array.- Returns:
- values as a new primitive array
-
recomputeMinMax
protected void recomputeMinMax()Recompute min/max by scanning current contents.
-