Package net.sourceforge.processdash.util

Examples of net.sourceforge.processdash.util.EnumerIterator


            this.filename = filename;
        }

        public EnumerIterator filter(String path, Date from, Date to)
                throws IOException {
            EnumerIterator result = new TimeLogReader(new IOExceptionInputStream(
                    openFile(filename), numBytes));
            if (path != null || from != null || to != null)
                result = new TimeLogIteratorFilter(result, path, from, to);
            return result;
        }
View Full Code Here


        assertTimeLogHashcodes(expectedHashcodes, iter);
    }

    public void testOldStyleBoundaryCases() throws Exception {
        // nonexistent file
        EnumerIterator iter = new OldStyleTimeLogReader(new File("foo"),
                new DummyIDSource());
        assertFalse(iter.hasNext());
        assertFalse(iter.hasMoreElements());
        try {
            iter.next();
            fail("Expected NoSuchElementException");
        } catch (NoSuchElementException nsee) {
        }
        try {
            iter.nextElement();
            fail("Expected NoSuchElementException");
        } catch (NoSuchElementException nsee) {
        }
        try {
            iter.remove();
            fail("Expected UnsupportedOperationException");
        } catch (UnsupportedOperationException nsee) {
        }

        try {
            iter = new OldStyleTimeLogReader(new IOExceptionInputStream(
                    openFile(TIMELOG1_TXT), 200));
            fail("Expected IOException");
        } catch (IOException ioe) {
        }

        try {
            iter = new OldStyleTimeLogReader(new IOExceptionInputStream(
                    openFile(TIMELOG1_TXT), 10000));
            while (iter.hasNext())
                iter.next();
            fail("Expected IONoSuchElementException");
        } catch (IONoSuchElementException ionsee) {
            // expected behavior
        } catch (IOException ioe) {
            fail("Expected IONoSuchElementException");
View Full Code Here

//        }
    }

    public void testNewStyleBoundaryCases() throws Exception {
        // nonexistent file
        EnumerIterator iter = new TimeLogReader(new File("foo"));
        assertFalse(iter.hasNext());
        assertFalse(iter.hasMoreElements());
        try {
            iter.next();
            fail("Expected NoSuchElementException");
        } catch (NoSuchElementException nsee) {
        }
        try {
            iter.nextElement();
            fail("Expected NoSuchElementException");
        } catch (NoSuchElementException nsee) {
        }
        try {
            iter.remove();
            fail("Expected UnsupportedOperationException");
        } catch (UnsupportedOperationException nsee) {
        }
    }
View Full Code Here

    public BaseTimeLog(File file) {
        timeLogFile = file;
    }

    public EnumerIterator filter(String path, Date from, Date to) throws IOException {
        EnumerIterator result = new TimeLogReader(timeLogFile);
        if (path != null || from != null || to != null)
            result = new TimeLogIteratorFilter(result, path, from, to);
        return result;
    }
View Full Code Here

            Iterator regularEntries = context.getTimeLog().filter(onePrefix,
                    from, to);
            maybeAddEntries(entries, regularEntries, pathRemapper);
        }

        EnumerIterator result = new IteratorConcatenator(entries);
        result = new TimeLogIteratorFilter(result, path, from, to);

        return result;
    }
View Full Code Here

            return parent.filter(path, from, to);

        Iterator baseEntries = parent.filter(null, null, null);
        Iterator modifiedEntries = new ModifiedEntriesFilter(baseEntries);
        Iterator addedEntries = new AddedEntriesFilter();
        EnumerIterator allEntries = new IteratorConcatenator(modifiedEntries,
                addedEntries);
        if (path == null && from == null && to == null)
            return allEntries;
        else
            return new TimeLogIteratorFilter(allEntries, path, from, to);
View Full Code Here

    private void getActualTimeSpentIndiv(Map<String, Map<String, Double>> result,
            Date fromDate, Date toDate) {
        // scan the time log and gather up the actual time spent per task
        Map<String, Double> actualTimes = new HashMap();
        try {
            EnumerIterator timeLogEntries = getDashboardContext().getTimeLog()
                    .filter(null, fromDate, toDate);
            while (timeLogEntries.hasNext()) {
                TimeLogEntry tle = (TimeLogEntry) timeLogEntries.next();
                String path = tle.getPath();
                double time = tle.getElapsedTime();
                sumActualTime(actualTimes, path, time);
            }
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.util.EnumerIterator

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.