@Test public void testHashCode() { TimeSeries s1 = new TimeSeries("Test"); TimeSeries s2 = new TimeSeries("Test"); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(1, 1, 2007), 500.0); s2.add(new Day(1, 1, 2007), 500.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(2, 1, 2007), null); s2.add(new Day(2, 1, 2007), null); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(5, 1, 2007), 111.0); s2.add(new Day(5, 1, 2007), 111.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(9, 1, 2007), 1.0); s2.add(new Day(9, 1, 2007), 1.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); }
@Override public int hashCode() { int result = super.hashCode(); result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0); result = 29 * result + (this.range != null ? this.range.hashCode() : 0); result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0); int count = getItemCount(); if (count > 0) { TimeSeriesDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { TimeSeriesDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { TimeSeriesDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (int) this.maximumItemAge; return result; }
TimeSeries extends Series implements Cloneable, Serializable { @Override public int hashCode() { int result = super.hashCode(); result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0); result = 29 * result + (this.range != null ? this.range.hashCode() : 0); result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0); int count = getItemCount(); if (count > 0) { TimeSeriesDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { TimeSeriesDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { TimeSeriesDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (int) this.maximumItemAge; return result; } }
TimeSeries extends Series implements Cloneable, Serializable { @Override public int hashCode() { int result = super.hashCode(); result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0); result = 29 * result + (this.range != null ? this.range.hashCode() : 0); result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0); int count = getItemCount(); if (count > 0) { TimeSeriesDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { TimeSeriesDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { TimeSeriesDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (int) this.maximumItemAge; return result; } TimeSeries(Comparable name);  TimeSeries(Comparable name, String domain, String range); }
TimeSeries extends Series implements Cloneable, Serializable { @Override public int hashCode() { int result = super.hashCode(); result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0); result = 29 * result + (this.range != null ? this.range.hashCode() : 0); result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0); int count = getItemCount(); if (count > 0) { TimeSeriesDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { TimeSeriesDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { TimeSeriesDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (int) this.maximumItemAge; return result; } 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 { @Override public int hashCode() { int result = super.hashCode(); result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0); result = 29 * result + (this.range != null ? this.range.hashCode() : 0); result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0); int count = getItemCount(); if (count > 0) { TimeSeriesDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { TimeSeriesDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { TimeSeriesDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (int) this.maximumItemAge; return result; } 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();  }