/** * Updates (changes) the value for a time period. Throws a * {@link SeriesException} if the period does not exist. * * @param period the period ({@code null} not permitted). * @param value the value ({@code null} permitted). */ public void update(RegularTimePeriod period, Number value) { TimeSeriesDataItem temp = new TimeSeriesDataItem(period, value); int index = Collections.binarySearch(this.data, temp); if (index < 0) { throw new SeriesException("There is no existing value for the " + "specified 'period'."); } update(index, value); }
/** * This method adds the specified stream elements to the timeSeries of the * appropriate plot. * * @param streamElement */ public synchronized void addData ( StreamElement streamElement ) { for ( int i = 0 ; i < streamElement.getFieldNames( ).length ; i++ ) { TimeSeries timeSeries = dataForTheChart.get( streamElement.getFieldNames( )[ i ] ); if ( timeSeries == null ) { dataForTheChart.put( streamElement.getFieldNames( )[ i ] , timeSeries = new TimeSeries( streamElement.getFieldNames( )[ i ] , org.jfree.data.time.FixedMillisecond.class ) ); if(isTimeBased){ timeSeries.setMaximumItemAge(historySize); }else{ timeSeries.setMaximumItemCount(historySize); } dataCollectionForTheChart.addSeries( timeSeries ); } try { timeSeries.addOrUpdate( new FixedMillisecond( new Date( streamElement.getTimeStamp( ) ) ) , Double.parseDouble( streamElement.getData( )[ i ].toString( ) ) ); } catch ( SeriesException e ) { logger.warn( e.getMessage( ) , e ); } } changed = true; }
/** * Updates (changes) the value for a time period. Throws a * {@link SeriesException} if the period does not exist. * * @param period the period (<code>null</code> not permitted). * @param value the value (<code>null</code> permitted). */ public void update(RegularTimePeriod period, Number value) { TimeSeriesDataItem temp = new TimeSeriesDataItem(period, value); int index = Collections.binarySearch(this.data, temp); if (index < 0) { throw new SeriesException("There is no existing value for the " + "specified 'period'."); } update(index, value); }
/** * Updates an item in the series. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ public void update(Number x, Number y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } updateByIndex(index, y); }
/** * Updates an item in the series. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ public void update(Number x, Number y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } else { updateByIndex(index, y); } }
throw new SeriesException("X-value already exists."); throw new SeriesException("X-value already exists.");
throw new SeriesException("X-value already exists."); throw new SeriesException("X-value already exists.");
b.append(this.timePeriodClass.getName()); b.append("."); throw new SeriesException(b.toString()); b.append(" for that time period. Duplicates are not "); b.append("permitted. Try using the addOrUpdate() method."); throw new SeriesException(b.toString());
b.append(this.timePeriodClass.getName()); b.append("."); throw new SeriesException(b.toString()); b.append(" for that time period. Duplicates are not "); b.append("permitted. Try using the addOrUpdate() method."); throw new SeriesException(b.toString());
throw new SeriesException("X-value already exists."); throw new SeriesException("X-value already exists.");
throw new SeriesException("X-value already exists."); throw new SeriesException("X-value already exists.");
/** * Updates an item in the series. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ protected void update(Comparable x, Object y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } else { ComparableObjectItem item = getDataItem(index); item.setObject(y); fireSeriesChanged(); } }
/** * Updates an item in the series. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ protected void update(Comparable x, Object y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } else { ComparableObjectItem item = getDataItem(index); item.setObject(y); fireSeriesChanged(); } }
+ ", but the TimeSeries is expecting an instance of " + this.timePeriodClass.getName() + "."; throw new SeriesException(msg);
+ ", but the TimeSeries is expecting an instance of " + this.timePeriodClass.getName() + "."; throw new SeriesException(msg);