/** * Returns a shallow copy of this <tt>LongList</tt> instance. (The * elements themselves are not copied.) * * @return a clone of this <tt>LongList</tt> instance */ public DoubleList copy() { DoubleList v = new DoubleList(size); v.doubles = Arrays.copyOf(doubles, size); v.size = size; return v; }
/** * @param scale to be applied to the values of this list * @return a new instance scaled with the given parameter */ public DoubleList scale(double scale) { DoubleList scaled = new DoubleList(size); for (int i = 0; i < size; i++) { scaled.add(doubles[i] * scale); } return scaled; }
/** * Private constructor. * To instantiate a metric time series use the builder class. */ private MetricTimeSeries() { timestamps = new LongList(500); values = new DoubleList(500); }
/** * Private constructor. * To instantiate a metric time series use the builder class. */ private MetricTimeSeries() { timestamps = new LongList(500); values = new DoubleList(500); }
private LazyCompactionResultSet(Iterable<Document> documents, IndexSchema schema) { this.documents = documents.iterator(); this.schema = schema; this.converterService = new ConverterService(); this.timestamps = new LongList(); this.values = new DoubleList(); }
/** * @param list the list * @param start the start index * @param end the end index * @return sublist */ public static DoubleList subList(DoubleList list, int start, int end) { if (list.isEmpty()) { return list; } if (start < 0 || end > list.size()) { throw new IndexOutOfBoundsException(""); } return new DoubleList(copyOfRange(list.toArray(), start, end), end - start); } }
/** * Sorts the time series values. */ public void sort() { if (timestamps.size() > 1) { LongList sortedTimes = new LongList(timestamps.size()); DoubleList sortedValues = new DoubleList(values.size()); points().sorted((o1, o2) -> Long.compare(o1.getTimestamp(), o2.getTimestamp())).forEachOrdered(p -> { sortedTimes.add(p.getTimestamp()); sortedValues.add(p.getValue()); }); timestamps = sortedTimes; values = sortedValues; } }
/** * Sorts the time series values. */ public void sort() { if (needsSort && timestamps.size() > 1) { LongList sortedTimes = new LongList(timestamps.size()); DoubleList sortedValues = new DoubleList(values.size()); points().sorted((o1, o2) -> Long.compare(o1.getTimestamp(), o2.getTimestamp())).forEachOrdered(p -> { sortedTimes.add(p.getTimestamp()); sortedValues.add(p.getValue()); }); timestamps = sortedTimes; values = sortedValues; needsSort = false; } }
builder.points(new LongList(timestamps, lastPointIndex), new DoubleList(values, lastPointIndex));
builder.points(new LongList(timestamps, lastPointIndex), new DoubleList(values, lastPointIndex));
DoubleList valueList = new DoubleList(timeSeries.size());
values = new DoubleList(calcAmountOfPoints);