/** * Returns the value at the specified index. * * @param index index of a value. * * @return The value (possibly <code>null</code>). */ public Number getValue(int index) { return getRawDataItem(index).getValue(); }
/** * Returns the value at the specified index. * * @param index index of a value. * * @return The value (possibly {@code null}). */ public Number getValue(int index) { return getRawDataItem(index).getValue(); }
/** * Updates the cached values for the minimum and maximum data values. * * @param item the item added ({@code null} not permitted). * * @since 1.0.14 */ private void updateBoundsForAddedItem(TimeSeriesDataItem item) { Number yN = item.getValue(); if (item.getValue() != null) { double y = yN.doubleValue(); this.minY = minIgnoreNaN(this.minY, y); this.maxY = maxIgnoreNaN(this.maxY, y); } }
/** * Updates the cached values for the minimum and maximum data values. * * @param item the item added (<code>null</code> not permitted). * * @since 1.0.14 */ private void updateBoundsForAddedItem(TimeSeriesDataItem item) { Number yN = item.getValue(); if (item.getValue() != null) { double y = yN.doubleValue(); this.minY = minIgnoreNaN(this.minY, y); this.maxY = maxIgnoreNaN(this.maxY, y); } }
/** * Updates the cached values for the minimum and maximum data values on * the basis that the specified item has just been removed. * * @param item the item added ({@code null} not permitted). * * @since 1.0.14 */ private void updateBoundsForRemovedItem(TimeSeriesDataItem item) { Number yN = item.getValue(); if (yN != null) { double y = yN.doubleValue(); if (!Double.isNaN(y)) { if (y <= this.minY || y >= this.maxY) { updateMinMaxYByIteration(); } } } }
/** * Updates the cached values for the minimum and maximum data values on * the basis that the specified item has just been removed. * * @param item the item added (<code>null</code> not permitted). * * @since 1.0.14 */ private void updateBoundsForRemovedItem(TimeSeriesDataItem item) { Number yN = item.getValue(); if (yN != null) { double y = yN.doubleValue(); if (!Double.isNaN(y)) { if (y <= this.minY || y >= this.maxY) { findBoundsByIteration(); } } } }
/** * Retrieve the maximum average throughput of the <code>ResponsetimeSample</code> instances. * * @return the maximum of a moving average of the throughput */ public final double getMaxAverageThroughput( int averageduration ) { TimeSeries series = createMovingThroughput( "" ); TimeSeries averageseries = MovingAverage.createMovingAverage( series, "", averageduration, 0 ); double max = 0; for ( Iterator it = averageseries.getItems().iterator(); it.hasNext(); ) { TimeSeriesDataItem item = (TimeSeriesDataItem) it.next(); if ( item.getValue() != null ) { max = Math.max( max, item.getValue().doubleValue() ); } } return max; }
/** * Updates (changes) the value of a data item. * * @param index the index of the data item. * @param value the new value (<code>null</code> permitted). */ public void update(int index, Number value) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.get(index); boolean iterate = false; Number oldYN = item.getValue(); if (oldYN != null) { double oldY = oldYN.doubleValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } } item.setValue(value); if (iterate) { findBoundsByIteration(); } else if (value != null) { double yy = value.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }
/** * Updates (changes) the value of a data item. * * @param index the index of the data item. * @param value the new value ({@code null} permitted). */ public void update(int index, Number value) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.get(index); boolean iterate = false; Number oldYN = item.getValue(); if (oldYN != null) { double oldY = oldYN.doubleValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } } item.setValue(value); if (iterate) { updateMinMaxYByIteration(); } else if (value != null) { double yy = value.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }
Number oldYN = existing.getValue(); double oldY = oldYN != null ? oldYN.doubleValue() : Double.NaN; if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; existing.setValue(item.getValue()); if (iterate) { updateMinMaxYByIteration(); else if (item.getValue() != null) { double yy = item.getValue().doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy);
/** * Builds a DataPoint from the given TimeSeriesDataItem. The name used for * the independent, time variable can be changed using the setTimeVariable * method. * @param dataItem the TimeSeriesDataItem from which the values are to be * read and used to construct a new DataPoint. * @return a DataPoint object with values as specified by the given * TimeSeriesDataItem. */ private DataPoint build( TimeSeriesDataItem dataItem ) { DataPoint dataPoint = new Observation( dataItem.getValue().doubleValue() ); // Get time value (at middle of time period) double timeValue = dataItem.getPeriod().getMiddleMillisecond(); // Store time value as independent variable dataPoint.setIndependentValue( getVariableName(0), timeValue ); return dataPoint; } }
/** * Builds a DataPoint from the given TimeSeriesDataItem. The name used for * the independent, time variable can be changed using the setTimeVariable * method. * @param dataItem the TimeSeriesDataItem from which the values are to be * read and used to construct a new DataPoint. * @return a DataPoint object with values as specified by the given * TimeSeriesDataItem. */ private DataPoint build( TimeSeriesDataItem dataItem ) { DataPoint dataPoint = new Observation( dataItem.getValue().doubleValue() ); // Get time value (at middle of time period) double timeValue = dataItem.getPeriod().getMiddleMillisecond(); // Store time value as independent variable dataPoint.setIndependentValue( getVariableName(0), timeValue ); return dataPoint; } }
long millis = item.getPeriod().getMillisecond(xAnchor, calendar); if (xRange.contains(millis)) { Number n = item.getValue(); if (n != null) { double v = n.doubleValue();
@Override public TimeSeries validate(TimeSeries timeSeries, String sourceName, TimeSeriesType type) throws ParseException { String qualifiedSourceName = createQualifiedSourcename(sourceName, type); final Symbol symbol = namespace.resolveSymbol(qualifiedSourceName); if (symbol == null) { throw new ParseException("No variable for identifier '" + qualifiedSourceName + "' registered."); } final String expression = getExpressionFor(qualifiedSourceName); if (expression == null || expression.trim().isEmpty()) { return timeSeries; } final Variable variable = (Variable) symbol; final Term term = parser.parse(expression, namespace); final int seriesCount = timeSeries.getItemCount(); final TimeSeries validatedSeries = new TimeSeries(timeSeries.getKey()); for (int i = 0; i < seriesCount; i++) { final TimeSeriesDataItem dataItem = timeSeries.getDataItem(i); final Number value = dataItem.getValue(); variable.assignD(null, value.doubleValue()); if (term.evalB(null)) { validatedSeries.add(dataItem); } } return validatedSeries; }
/** * Adds or updates data from one series to another. Returns another series * containing the values that were overwritten. * * @param series the series to merge with this. * * @return A series containing the values that were overwritten. */ public TimeSeries addAndOrUpdate(TimeSeries series) { TimeSeries overwritten = new TimeSeries("Overwritten values from: " + getKey()); for (int i = 0; i < series.getItemCount(); i++) { TimeSeriesDataItem item = series.getRawDataItem(i); TimeSeriesDataItem oldItem = addOrUpdate(item.getPeriod(), item.getValue()); if (oldItem != null) { overwritten.add(oldItem); } } return overwritten; }
/** * Adds or updates data from one series to another. Returns another series * containing the values that were overwritten. * * @param series the series to merge with this. * * @return A series containing the values that were overwritten. */ public TimeSeries addAndOrUpdate(TimeSeries series) { TimeSeries overwritten = new TimeSeries("Overwritten values from: " + getKey()); for (int i = 0; i < series.getItemCount(); i++) { TimeSeriesDataItem item = series.getRawDataItem(i); TimeSeriesDataItem oldItem = addOrUpdate(item.getPeriod(), item.getValue()); if (oldItem != null) { overwritten.add(oldItem); } } return overwritten; }
i - offset); RegularTimePeriod p = item.getPeriod(); Number v = item.getValue(); long currentIndex = p.getSerialIndex(); if (currentIndex > serialLimit) {
i - offset); RegularTimePeriod p = item.getPeriod(); Number v = item.getValue(); long currentIndex = p.getSerialIndex(); if (currentIndex > serialLimit) {