/** * Appends the specified element to the end of this list. * * @param e element to be appended to this list * @return <tt>true</tt> (as specified by Collection#add) */ public boolean add(double e) { int newCapacity = calculateNewCapacity(doubles.length, size + 1); growIfNeeded(newCapacity); doubles[size++] = e; return true; }
/** * Adds the given single data point to the time series * * @param timestamp the timestamp of the value * @param value the belonging value * @return the builder */ public Builder point(long timestamp, double value) { metricTimeSeries.timestamps.add(timestamp); metricTimeSeries.values.add(value); return this; }
/** * Private constructor. * To instantiate a metric time series use the builder class. */ private MetricTimeSeries() { timestamps = new LongList(500); values = new DoubleList(500); }
/** * Gets the timestamp at the given index * * @param i the index position of the time stamp * @return the timestamp as long */ public long getTime(int i) { return timestamps.get(i); }
/** * @return the size */ public int size() { return timestamps.size(); }
/** * Appends the specified element to the end of this list. * * @param e element to be appended to this list * @return <tt>true</tt> (as specified by Collection#add) */ public boolean add(long e) { int newCapacity = calculateNewCapacity(longs.length, size + 1); growIfNeeded(newCapacity); longs[size++] = e; return true; }
/** * @return maximum of the values of the list */ public double max() { return values.max(); }
/** * @return average of the values of the list */ public double avg() { return values.avg(); }
/** * Returns <tt>true</tt> if this list contains the specified element. * More formally, returns <tt>true</tt> if and only if this list contains * at least one element <tt>e</tt> such that * <tt>(o==null ? e==null : o.equals(e))</tt>. * * @param o element whose presence in this list is to be tested * @return <tt>true</tt> if this list contains the specified element */ public boolean contains(Long o) { return indexOf(o) >= 0; }
/** * Returns the element at the specified position in this list. * * @param index index of the element to return * @return the element at the specified position in this list * @throws IndexOutOfBoundsException */ public long get(int index) { rangeCheck(index, size); return longs[index]; }
/** * Private constructor. * To instantiate a metric time series use the builder class. */ private MetricTimeSeries() { timestamps = new LongList(500); values = new DoubleList(500); }
/** * Adds the given single data point to the time series * * @param timestamp the timestamp of the value * @param value the belonging value * @return the builder */ public Builder point(long timestamp, double value) { metricTimeSeries.timestamps.add(timestamp); metricTimeSeries.values.add(value); return this; }