Package de.timefinder.data.algo

Examples of de.timefinder.data.algo.Assignment


        assertEquals(0, eventRaster.getNextFree(0, 1));
        assertEquals(LENGTH, eventRaster.getLastFreePlus1(0));
        assertEquals(LENGTH, eventRaster.getLastFreePlus1(LENGTH - 1));
        assertEquals(-1, eventRaster.getLastFreePlus1(LENGTH));

        Assignment ass = newAssignment(0, 5);

        assertTrue(eventRaster.add(ass));
        assertEquals(5, eventRaster.getNextFree(0, 1));

        eventRaster.remove(ass);
        try {
            // should NOT add an event which stays in conflicts to root event
            eventRaster.setRoot(ass);
            Assignment tmpEvent = newAssignment(3, 1);
            eventRaster.add(tmpEvent);
            assertTrue(false);
        } catch (Throwable ex) {
            assertTrue(true);
        }
View Full Code Here


        }
    }

    @Test
    public void testNextFree2() {
        Assignment event1 = newAssignment(0, 5);
        assertTrue(eventRaster.add(event1));
        assertEquals(5, eventRaster.getNextFree(0, 1));

        // allow conflicting between the other events -> important
        Assignment event2 = newAssignment(4, 3);
        assertTrue(eventRaster.add(event2));
        assertEquals(7, eventRaster.getNextFree(0, 1));
        assertTrue(eventRaster.remove(event2));

        // external duration change is supported only by some implementations
View Full Code Here

        assertEquals(15, eventRaster.getNextFree(15, 1));
    }

    @Test
    public void testNextFree3() {
        Assignment event2 = newAssignment(5, 1);
        eventRaster.add(event2);

        Assignment event1 = newAssignment(0, 5);
        eventRaster.add(event1);

        Assignment event3 = newAssignment(9, 1);
        eventRaster.add(event3);

        assertEquals(6, eventRaster.getNextFree(0, 1));
        assertEquals(7, eventRaster.getNextFree(7, 1));
        assertEquals(8, eventRaster.getNextFree(8, 1));
View Full Code Here

        assertEquals(12, eventRaster.getNextFree(12, 4));
    }

    @Test
    public void testNextFree4() {
        Assignment ev1 = newAssignment(0, 4);
        Assignment ev2 = newAssignment(1, 4);
        Assignment ev3 = newAssignment(5, 1);

        assertTrue(eventRaster.add(ev1));
        assertTrue(eventRaster.add(ev2));
        assertTrue(eventRaster.add(ev3));
View Full Code Here

        assertEquals(6, eventRaster.getNextFree(0, 1));
    }

    @Test
    public void testNextFree5() {
        Assignment ev1 = newAssignment(0, 3);
        Assignment ev2 = newAssignment(2, 3);
        Assignment ev3 = newAssignment(1, 5);
        Assignment ev4 = newAssignment(6, 1);

        assertTrue(eventRaster.add(ev1));
        assertTrue(eventRaster.add(ev2));
        assertTrue(eventRaster.add(ev3));
        assertTrue(eventRaster.add(ev4));
View Full Code Here

        assertEquals(7, eventRaster.getNextFree(0, 1));
    }

    @Test
    public void testNextFree6() {
        Assignment ev1 = newAssignment(0, 10);
        Assignment ev2 = newAssignment(2, 1);
        Assignment ev3 = newAssignment(8, 1);

        assertTrue(eventRaster.add(ev1));
        assertTrue(eventRaster.add(ev2));
        assertTrue(eventRaster.add(ev3));
View Full Code Here

        assertEquals(10, eventRaster.getNextFree(3, 1));
    }

    @Test
    public void testFirstFree() {
        Assignment event1 = newAssignment(1, 5);
        assertTrue(eventRaster.add(event1));
        assertEquals(0, eventRaster.getNextFree(0, 1));
    }
View Full Code Here

        assertEquals(0, eventRaster.getNextFree(0, 1));
    }

    @Test
    public void testRemoveAndAdd() {
        Assignment event1 = newAssignment(0, 5);
        assertTrue(eventRaster.add(event1));
        assertEquals(5, eventRaster.getNextFree(0, 1));

        assertTrue(eventRaster.remove(event1));
        event1.setStart(1);
        assertTrue(eventRaster.add(event1));
        assertEquals(0, eventRaster.getNextFree(0, 1));
    }
View Full Code Here

        assertEquals(0, eventRaster.getNextFree(0, 1));
    }

    @Test
    public void testRemove() {
        Assignment event1 = newAssignment("1", 0, 5);
        Assignment event2 = newAssignment("2", 0, 5);

        assertTrue(eventRaster.add(event1));
        assertTrue(eventRaster.add(event2));

        assertEquals(2, eventRaster.getConflictingAssignments(0, 1).size());
View Full Code Here

        assertEquals(0, eventRaster.getConflictingAssignments(0, 1).size());
    }

    @Test
    public void testGetConflictingEvents() {
        Assignment rootEvent = newAssignment(10, 1);
        eventRaster.setRoot(rootEvent);

        Assignment event1 = newAssignment(0, 5);
        assertTrue(eventRaster.add(event1));

        Assignment event2 = newAssignment(4, 3);
        assertTrue(eventRaster.add(event2));

        assertEquals(2, eventRaster.getConflictingAssignments(4, 1).size());
        assertEquals(2, eventRaster.getConflictingAssignments(4, 2).size());
        assertEquals(2, eventRaster.getConflictingAssignments(3, 2).size());
View Full Code Here

TOP

Related Classes of de.timefinder.data.algo.Assignment

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.