@@ -0,0 +1,1377 @@
+package cz.cuni.mff.d3s.spl.core.data.segment;%0A%0Aimport cz.cuni.mff.d3s.spl.core.data.SampleBasedDataSource;%0A%0Apublic class AutoSlidingTimeSlotDataSource extends SlidingTimeSlotDataSource %7B%0A%09private static final long SEC_TO_MILLIS = 1000;%0A%09private long lastClock = 0;%0A%09%0A%09public static AutoSlidingTimeSlotDataSource createSec(long slotOffsetSec, long slotLengthSec) %7B%0A%09%09long startTimeSec = slotOffsetSec - slotLengthSec;%0A%09%09long startTimeMillis = startTimeSec * SEC_TO_MILLIS;%0A%09%09long endTimeMillis = slotOffsetSec * SEC_TO_MILLIS;%0A%09%09return new AutoSlidingTimeSlotDataSource(startTimeMillis, endTimeMillis);%0A%09%7D%0A%09%0A%09public static AutoSlidingTimeSlotDataSource createSec(SampleBasedDataSource parent, long slotOffsetSec, long slotLengthSec) %7B%0A%09%09AutoSlidingTimeSlotDataSource result = createSec(slotOffsetSec, slotLengthSec);%0A%09%09parent.addSubSource(result);%0A%09%09return result;%0A%09%7D%0A%09%0A%09private AutoSlidingTimeSlotDataSource() %7B%0A%09%09this(0, 0);%0A%09%7D%0A%09%0A%09private AutoSlidingTimeSlotDataSource(long start, long end) %7B%0A%09%09super(start, end);%0A%09%7D%0A%09%0A%09@Override%0A%09public void shift(long offset) %7B%0A%09%09throw new UnsupportedOperationException(%22shift() does not make sense auto-sliding source.%22);%0A%09%7D%0A%09%0A%09@Override%0A%09public void newSample(long sample, long clock) %7B%0A%09%09long clockNow = System.currentTimeMillis() + 1;%0A%09%09super.shift(clockNow - lastClock);%0A%09%09lastClock = clockNow;%0A%09%09super.newSample(sample, clock);%0A%09%7D%0A%7D%0A

Add auto-sliding data source