public class FlowGaps {
public static void main(String args[]) {
Calendar cal = Calendar.getInstance();
FlowSource firstSource = null;
FlowSource lastSource = null;
for (String path : args) {
FlowSourceSet sourceSet = FlowTools.getSourceFromDir(new File(path), true);
if (lastSource != null)
sourceSet.addFlowSource(lastSource);
List<FlowSource> sources = sourceSet.getEffectiveSources();
for (int i = 0; i < sources.size() - 1; i++) {
FlowSource s1 = sources.get(i);
FlowSource s2 = lastSource = sources.get(i + 1);
if (firstSource == null)
firstSource = s1;
cal.setTime(s2.getFirstFlowTime());
long s2Start = cal.getTimeInMillis();
cal.setTime(s1.getLastFlowTime());
long s1End = cal.getTimeInMillis();
long diff = s2Start - s1End;
long hourMillis = 60 * 60 * 1000;
if (diff >= hourMillis) {
System.out.println("Gap: " + s1.getLastFlowTime() + " -> " + s2.getFirstFlowTime() + ": more than hour");
}
}
}
System.out.println("Overall: " + firstSource.getFirstFlowTime() + " -> " + lastSource.getLastFlowTime());