@Test public void testGetIndex() { TimeSeries series = new TimeSeries("Series"); assertEquals(-1, series.getIndex(new Month(1, 2003))); series.add(new Month(1, 2003), 45.0); assertEquals(0, series.getIndex(new Month(1, 2003))); assertEquals(-1, series.getIndex(new Month(12, 2002))); assertEquals(-2, series.getIndex(new Month(2, 2003))); series.add(new Month(3, 2003), 55.0); assertEquals(-1, series.getIndex(new Month(12, 2002))); assertEquals(0, series.getIndex(new Month(1, 2003))); assertEquals(-2, series.getIndex(new Month(2, 2003))); assertEquals(1, series.getIndex(new Month(3, 2003))); assertEquals(-3, series.getIndex(new Month(4, 2003))); }
public int getIndex(RegularTimePeriod period) { ParamChecks.nullNotPermitted(period, "period"); TimeSeriesDataItem dummy = new TimeSeriesDataItem( period, Integer.MIN_VALUE); return Collections.binarySearch(this.data, dummy); }
TimeSeries extends Series implements Cloneable, Serializable { public int getIndex(RegularTimePeriod period) { ParamChecks.nullNotPermitted(period, "period"); TimeSeriesDataItem dummy = new TimeSeriesDataItem( period, Integer.MIN_VALUE); return Collections.binarySearch(this.data, dummy); } }
TimeSeries extends Series implements Cloneable, Serializable { public int getIndex(RegularTimePeriod period) { ParamChecks.nullNotPermitted(period, "period"); TimeSeriesDataItem dummy = new TimeSeriesDataItem( period, Integer.MIN_VALUE); return Collections.binarySearch(this.data, dummy); } TimeSeries(Comparable name);  TimeSeries(Comparable name, String domain, String range); }
TimeSeries extends Series implements Cloneable, Serializable { public int getIndex(RegularTimePeriod period) { ParamChecks.nullNotPermitted(period, "period"); TimeSeriesDataItem dummy = new TimeSeriesDataItem( period, Integer.MIN_VALUE); return Collections.binarySearch(this.data, dummy); } TimeSeries(Comparable name);  TimeSeries(Comparable name, String domain, String range); String getDomainDescription(); void setDomainDescription(String description); String getRangeDescription(); void setRangeDescription(String description); @Override int getItemCount(); List<TimeSeriesDataItem> getItems(); int getMaximumItemCount(); void setMaximumItemCount(int maximum); long getMaximumItemAge(); void setMaximumItemAge(long periods); Range findValueRange(); Range findValueRange(Range xRange, TimeZone timeZone); Range findValueRange(Range xRange, TimePeriodAnchor xAnchor, 
            TimeZone zone); double getMinY(); double getMaxY(); Class getTimePeriodClass(); TimeSeriesDataItem getDataItem(int index); TimeSeriesDataItem getDataItem(RegularTimePeriod period); RegularTimePeriod getTimePeriod(int index); RegularTimePeriod getNextTimePeriod(); Collection<RegularTimePeriod> getTimePeriods(); Collection<RegularTimePeriod> getTimePeriodsUniqueToOtherSeries(TimeSeries series); int getIndex(RegularTimePeriod period); Number getValue(int index); Number getValue(RegularTimePeriod period); void add(TimeSeriesDataItem item); void add(TimeSeriesDataItem item, boolean notify); void add(RegularTimePeriod period, double value); void add(RegularTimePeriod period, double value, boolean notify); void add(RegularTimePeriod period, Number value); void add(RegularTimePeriod period, Number value, boolean notify); void update(RegularTimePeriod period, double value); void update(RegularTimePeriod period, Number value); void update(int index, Number value); TimeSeries addAndOrUpdate(TimeSeries series); TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
                                          double value); TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
                                          Number value); TimeSeriesDataItem addOrUpdate(TimeSeriesDataItem item); void removeAgedItems(boolean notify); void removeAgedItems(long latest, boolean notify); void clear(); void delete(RegularTimePeriod period); void delete(int start, int end); void delete(int start, int end, boolean notify); @Override Object clone(); TimeSeries createCopy(int start, int end); TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end); @Override boolean equals(Object obj); @Override int hashCode(); }
TimeSeries extends Series implements Cloneable, Serializable { public int getIndex(RegularTimePeriod period) { ParamChecks.nullNotPermitted(period, "period"); TimeSeriesDataItem dummy = new TimeSeriesDataItem( period, Integer.MIN_VALUE); return Collections.binarySearch(this.data, dummy); } TimeSeries(Comparable name);  TimeSeries(Comparable name, String domain, String range); String getDomainDescription(); void setDomainDescription(String description); String getRangeDescription(); void setRangeDescription(String description); @Override int getItemCount(); List<TimeSeriesDataItem> getItems(); int getMaximumItemCount(); void setMaximumItemCount(int maximum); long getMaximumItemAge(); void setMaximumItemAge(long periods); Range findValueRange(); Range findValueRange(Range xRange, TimeZone timeZone); Range findValueRange(Range xRange, TimePeriodAnchor xAnchor, 
            TimeZone zone); double getMinY(); double getMaxY(); Class getTimePeriodClass(); TimeSeriesDataItem getDataItem(int index); TimeSeriesDataItem getDataItem(RegularTimePeriod period); RegularTimePeriod getTimePeriod(int index); RegularTimePeriod getNextTimePeriod(); Collection<RegularTimePeriod> getTimePeriods(); Collection<RegularTimePeriod> getTimePeriodsUniqueToOtherSeries(TimeSeries series); int getIndex(RegularTimePeriod period); Number getValue(int index); Number getValue(RegularTimePeriod period); void add(TimeSeriesDataItem item); void add(TimeSeriesDataItem item, boolean notify); void add(RegularTimePeriod period, double value); void add(RegularTimePeriod period, double value, boolean notify); void add(RegularTimePeriod period, Number value); void add(RegularTimePeriod period, Number value, boolean notify); void update(RegularTimePeriod period, double value); void update(RegularTimePeriod period, Number value); void update(int index, Number value); TimeSeries addAndOrUpdate(TimeSeries series); TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
                                          double value); TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
                                          Number value); TimeSeriesDataItem addOrUpdate(TimeSeriesDataItem item); void removeAgedItems(boolean notify); void removeAgedItems(long latest, boolean notify); void clear(); void delete(RegularTimePeriod period); void delete(int start, int end); void delete(int start, int end, boolean notify); @Override Object clone(); TimeSeries createCopy(int start, int end); TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end); @Override boolean equals(Object obj); @Override int hashCode();  }