Package ru.petrsu.akolosov.flowbrook

Examples of ru.petrsu.akolosov.flowbrook.FlowSource


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());
View Full Code Here

TOP

Related Classes of ru.petrsu.akolosov.flowbrook.FlowSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.