RegularTimeSeriesIndex extends AbstractTimeSeriesIndex { @Override public boolean equals(Object obj) { if (obj instanceof TimeSeriesIndex) { RegularTimeSeriesIndex otherIndex = (RegularTimeSeriesIndex) obj; return startTime == otherIndex.startTime && endTime == otherIndex.endTime && spacing == otherIndex.spacing; } return false; } RegularTimeSeriesIndex(long startTime, long endTime, long spacing); static RegularTimeSeriesIndex create(Instant start, Instant end, Duration spacing); static RegularTimeSeriesIndex create(Interval interval, Duration spacing); static RegularTimeSeriesIndex parseJson(JsonParser parser); long getStartTime(); long getEndTime(); long getSpacing(); @Override int getPointCount(); @Override long getTimeAt(int point); @Override int hashCode(); @Override boolean equals(Object obj); @Override String getType(); @Override void writeJson(JsonGenerator generator); @Override Iterator<Instant> iterator(); @Override Stream<Instant> stream(); @Override String toString(); static final String TYPE; }
@Test public void testEquals() { new EqualsTester() .addEqualityGroup(RegularTimeSeriesIndex.create(Interval.parse("2015-01-01T00:00:00Z/2015-01-01T01:00:00Z"), Duration.ofMinutes(15)), RegularTimeSeriesIndex.create(Interval.parse("2015-01-01T00:00:00Z/2015-01-01T01:00:00Z"), Duration.ofMinutes(15))) .addEqualityGroup(RegularTimeSeriesIndex.create(Interval.parse("2015-01-01T00:00:00Z/2015-01-01T01:15:00Z"), Duration.ofMinutes(30)), RegularTimeSeriesIndex.create(Interval.parse("2015-01-01T00:00:00Z/2015-01-01T01:15:00Z"), Duration.ofMinutes(30))) .testEquals(); }