@Test public void testGetElements() { TimeStore timestampStore = new TimeStore(null, null, true); TimestampIndexStore store = (TimestampIndexStore) timestampStore.nodeIndexStore; store.add(1.0); store.add(2.0); store.add(3.0); NodeImpl n0 = new NodeImpl(0); NodeImpl n1 = new NodeImpl(1); NodeImpl n2 = new NodeImpl(2); NodeImpl n3 = new NodeImpl(3); store.add(1.0, n0); store.add(1.0, n1); store.add(2.0, n2); store.add(3.0, n3); ObjectSet r1 = new ObjectOpenHashSet(getArrayFromIterable(store.mainIndex.get(new Interval(1.0, 1.0)))); Assert.assertTrue(r1.contains(n0)); Assert.assertTrue(r1.contains(n1)); Assert.assertEquals(r1.size(), 2); ObjectSet r2 = new ObjectOpenHashSet(getArrayFromIterable(store.mainIndex.get(new Interval(-1, 1.9)))); Assert.assertTrue(r2.contains(n0)); Assert.assertTrue(r2.contains(n1)); Assert.assertEquals(r2.size(), 2); ObjectSet r3 = new ObjectOpenHashSet(getArrayFromIterable(store.mainIndex.get(new Interval(-1, 2.0)))); Assert.assertTrue(r3.contains(n0)); Assert.assertTrue(r3.contains(n1)); Assert.assertTrue(r3.contains(n2)); Assert.assertEquals(r3.size(), 3); ObjectSet r4 = new ObjectOpenHashSet(getArrayFromIterable(store.mainIndex.get(new Interval(2.0, 2.0)))); Assert.assertTrue(r4.contains(n2)); Assert.assertEquals(r4.size(), 1); ObjectSet r5 = new ObjectOpenHashSet(getArrayFromIterable(store.mainIndex.get(new Interval(2.0, 3.5)))); Assert.assertTrue(r5.contains(n2)); Assert.assertTrue(r5.contains(n3)); Assert.assertEquals(r5.size(), 2); }
@Override public ElementIterable get(double timestamp) { checkDouble(timestamp); readLock(); Integer index = timestampIndexStore.timeSortedMap.get(timestamp); if (index != null && index < timestamps.length) { TimeIndexEntry ts = timestamps[index]; if (ts != null) { return new ElementIterableImpl(new ElementIteratorImpl(ts.elementSet.iterator())); } } readUnlock(); return ElementIterable.EMPTY; }
TimestampIndexImpl extends TimeIndexImpl<T, Double, TimestampSet, TimestampMap<?>> { @Override public ElementIterable get(double timestamp) { checkDouble(timestamp); readLock(); Integer index = timestampIndexStore.timeSortedMap.get(timestamp); if (index != null && index < timestamps.length) { TimeIndexEntry ts = timestamps[index]; if (ts != null) { return new ElementIterableImpl(new ElementIteratorImpl(ts.elementSet.iterator())); } } readUnlock(); return ElementIterable.EMPTY; } }
TimestampIndexImpl extends TimeIndexImpl<T, Double, TimestampSet, TimestampMap<?>> { @Override public ElementIterable get(double timestamp) { checkDouble(timestamp); readLock(); Integer index = timestampIndexStore.timeSortedMap.get(timestamp); if (index != null && index < timestamps.length) { TimeIndexEntry ts = timestamps[index]; if (ts != null) { return new ElementIterableImpl(new ElementIteratorImpl(ts.elementSet.iterator())); } } readUnlock(); return ElementIterable.EMPTY; } TimestampIndexImpl(TimeIndexStore<T, Double, TimestampSet, TimestampMap<?>> store, boolean main); }
TimestampIndexImpl extends TimeIndexImpl<T, Double, TimestampSet, TimestampMap<?>> { @Override public ElementIterable get(double timestamp) { checkDouble(timestamp); readLock(); Integer index = timestampIndexStore.timeSortedMap.get(timestamp); if (index != null && index < timestamps.length) { TimeIndexEntry ts = timestamps[index]; if (ts != null) { return new ElementIterableImpl(new ElementIteratorImpl(ts.elementSet.iterator())); } } readUnlock(); return ElementIterable.EMPTY; } 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); }
TimestampIndexImpl extends TimeIndexImpl<T, Double, TimestampSet, TimestampMap<?>> { @Override public ElementIterable get(double timestamp) { checkDouble(timestamp); readLock(); Integer index = timestampIndexStore.timeSortedMap.get(timestamp); if (index != null && index < timestamps.length) { TimeIndexEntry ts = timestamps[index]; if (ts != null) { return new ElementIterableImpl(new ElementIteratorImpl(ts.elementSet.iterator())); } } readUnlock(); return ElementIterable.EMPTY; } 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);  }