TimestampIndexImpl extends TimeIndexImpl<T, Double, TimestampSet, TimestampMap<?>> { @Override public double getMinTimestamp() { if (mainIndex) { Double2IntSortedMap sortedMap = (Double2IntSortedMap) timestampIndexStore.timeSortedMap; if (!sortedMap.isEmpty()) { return sortedMap.firstDoubleKey(); } } else { Double2IntSortedMap sortedMap = (Double2IntSortedMap) timestampIndexStore.timeSortedMap; if (!sortedMap.isEmpty()) { ObjectBidirectionalIterator<Double2IntMap.Entry> bi = sortedMap.double2IntEntrySet().iterator(); while (bi.hasNext()) { Double2IntMap.Entry entry = bi.next(); double timestamp = entry.getDoubleKey(); int index = entry.getIntValue(); if (index < timestamps.length) { TimeIndexEntry timestampEntry = timestamps[index]; if (timestampEntry != null) { return timestamp; } } } } } return Double.NEGATIVE_INFINITY; } TimestampIndexImpl(TimeIndexStore<T, Double, TimestampSet, TimestampMap<?>> store, boolean main); @Override double getMinTimestamp(); @Override double getMaxTimestamp(); @Override ElementIterable get(double timestamp); @Override ElementIterable get(Interval interval);  }
@Test public void testGetMin() { TimeStore timestampStore = new TimeStore(null, null, true); TimestampIndexStore store = (TimestampIndexStore) timestampStore.nodeIndexStore; Assert.assertEquals(store.mainIndex.getMinTimestamp(), Double.NEGATIVE_INFINITY); store.add(1.0); Assert.assertEquals(store.mainIndex.getMinTimestamp(), 1.0); store.add(2.0); Assert.assertEquals(store.mainIndex.getMinTimestamp(), 1.0); store.remove(1.0); Assert.assertEquals(store.mainIndex.getMinTimestamp(), 2.0); }