Package de.timefinder.data

Examples of de.timefinder.data.Event


            tmpDao.attachAll(sDao.getValue().values());
        }
    }

    protected Event newEvent() {
        Event ev = eDao.create();
        ev.putConstraint(new RasterConstraint(settings.createWeekRaster()));
        return ev;
    }
View Full Code Here


        int duration = (int) ((end.getMillis() - start.getMillis()) / settings.getMillisPerTimeslot());
        if (duration <= 0) {
            log.fatal("Cannot convert DateTimes - duration would be non-positive: " + duration + " start=" + start + " end=" + end);
        }

        Event evOut = new Event();
        evOut.setInterval(days * settings.getTimeslotsPerDay() + startSlot, duration);
        return evOut;
    }
View Full Code Here

                UnsupportedOperationException excFirstEl = new UnsupportedOperationException(
                        "First element in eventOrderConstraint must be the event!" + element.getPath());
                for (Object eocObj : element.elements()) {
                    Element eocEl = (Element) eocObj;
                    if ("event".equals(eocEl.getName())) {
                        Event ev = getObject(getRef(eocEl), Event.class);
                        constraint = new EventOrderConstraint(ev);
                    } else if ("beforeEvent".equals(eocEl.getName())) {
                        if (constraint == null)
                            throw excFirstEl;
                        Event ev = getObject(getRef(eocEl), Event.class);
                        ((EventOrderConstraint) constraint).addBefore(ev);
                    } else if ("followsEvent".equals(eocEl.getName())) {
                        if (constraint == null)
                            throw excFirstEl;
                        Event ev = getObject(getRef(eocEl), Event.class);
                        ((EventOrderConstraint) constraint).addFollow(ev);
                    } else
                        throw new UnsupportedOperationException("Element not supported in eventOrderConstraint:"
                                + eocEl.getPath());
                }
View Full Code Here

                int counter = 0;
                Dao<Event> eDao = dataPool.getDao(Event.class);
                for (JavaOneInterval ev : coll) {
                    pm.worked(10 + (int) (counter * tmp));
                    counter++;
                    Event event = eDao.create();
                    if (ev.getStart() >= 0 && ev.getDuration() > 0) {
                        IntervalInt si = settings.toInterval(ev.getStartDateTime(), ev.getEndDateTime());
                        if (si != null)
                            event.setInterval(si.getStart(), si.getDuration());
                    }
                    event.setName(ev.getId());
                    event.setDescription(ev.getDescription());
                    if (ev.getSpeakers() != null) {
                        for (String str : ev.getSpeakers().split(";")) {
                            str = str.trim();
                            Person p = persons.get(str);
                            if (p == null) {
View Full Code Here

        return Event.class;
    }

    @Override
    public Event create() {
        return new Event();
    }
View Full Code Here

    @Test
    public void testSimpleStart() throws Exception {
        settings.setNumberOfDays(1);
        settings.setTimeslotsPerDay(4);

        Event ev1 = new Event(3, 1);
        eDao.attach(ev1);
        Event ev2 = new Event(2, 1);
        eDao.attach(ev2);

        Location loc1 = new Location("loc1", 10);
        lDao.attach(loc1);

        unitimer = new UniTimeOptimization();
        unitimer.setCondition(new AlgorithmConditionTime(1));
        unitimer.setInitialAssignment(true);
        unitimer.setStatusBar(new ConsoleStatusBar());
        unitimer.setDataPool(dataPool);
        unitimer.setDataPoolSettings(settings);
        unitimer.start();

        assertTrue("start was:" + ev1.getStart(), ev1.getStart() < 2);
        assertTrue("start was:" + ev2.getStart(), ev2.getStart() < 2);
    }
View Full Code Here

        settings.setNumberOfDays(1);
        settings.setTimeslotsPerDay(2);

        Person p1 = new Person("p1");
        pDao.attach(p1);
        Event ev1 = new Event(2, 1);
        ev1.addPerson(p1, true);
        eDao.attach(ev1);
       
        Event ev2 = new Event(1, 1);
        eDao.attach(ev2);

        Location loc1 = new Location("loc1", 10);
        lDao.attach(loc1);

        unitimer = new UniTimeOptimization();
        unitimer.setCondition(new AlgorithmConditionTime(1));
        unitimer.setInitialAssignment(true);
        unitimer.setStatusBar(new ConsoleStatusBar());
        unitimer.setDataPool(dataPool);
        unitimer.setDataPoolSettings(settings);
        unitimer.start();

        assertTrue("start was:" + ev1.getStart(), ev1.getStart() == 0);
        assertTrue("start was:" + ev2.getStart(), ev2.getStart() == 1);
    }
View Full Code Here

    }

    @Test
    public void testToInterval() {
//        System.out.println("toInterval");
        Event event = new Event();

        event.setInterval(0, 1);
        assertEquals(settings.getStartDate(), settings.toDateTime(event.getStart()));
        assertEquals(settings.getStartDate().plusHours(1), settings.toDateTime(event.getEnd()));

        event.setInterval(settings.getTimeslotsPerDay(), 1);
        assertEquals(settings.getStartDate().plusDays(1), settings.toDateTime(event.getStart()));
        assertEquals(settings.getStartDate().plusDays(1).plusHours(1), settings.toDateTime(event.getEnd()));

        event.setInterval(0, 2);
        assertEquals(settings.getStartDate(), settings.toDateTime(event.getStart()));
        assertEquals(settings.getStartDate().plusHours(2), settings.toDateTime(event.getEnd()));

        event.setInterval(settings.getTimeslotsPerDay() - 1, 1);
        assertEquals(settings.getStartDate().plusHours(settings.getTimeslotsPerDay() - 1), settings.toDateTime(event.getStart()));
        assertEquals(settings.getStartDate().plusDays(1), settings.toDateTime(event.getEnd()));
    }
View Full Code Here

    @Test
    public void testToEvent() {
//        System.out.println("ToEvent");

        IntervalInt event = new Event();
        event.setInterval(0, 1);
        DateTime start = settings.toDateTime(event.getStart());
        DateTime end = settings.toDateTime(event.getEnd());
        assertEqualsEvent(event, settings.toInterval(start, end));

        event.setInterval(settings.getTimeslotsPerDay(), 1);
        start = settings.toDateTime(event.getStart());
        end = settings.toDateTime(event.getEnd());
        assertEqualsEvent(event, settings.toInterval(start, end));

        event.setInterval(0, 2);
        event.setInterval(settings.getTimeslotsPerDay(), 1);
        start = settings.toDateTime(event.getStart());
        end = settings.toDateTime(event.getEnd());
        assertEqualsEvent(event, settings.toInterval(start, end));

        event.setInterval(settings.getTimeslotsPerDay() - 1, 1);
        event.setInterval(settings.getTimeslotsPerDay(), 1);
        start = settings.toDateTime(event.getStart());
        end = settings.toDateTime(event.getEnd());
        assertEqualsEvent(event, settings.toInterval(start, end));
    }
View Full Code Here

    @Override
    public void setUp() {
        super.setUp();
        writer = new StringWriter();
        ev1 = new Event();
        ev2 = new Event();
        ev3 = new Event();
        ev4 = new Event();
        person1 = new Person();
        person2 = new Person();
        person3 = new Person();
        person4 = new Person();
        loc1 = new Location();
View Full Code Here

TOP

Related Classes of de.timefinder.data.Event

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.