Package de.timefinder.data

Examples of de.timefinder.data.Event


            Collection<? extends Resource> resources, boolean throwExc) {
        int counter = 0;
        for (Resource res : resources) {
            List<Event> events = new ArrayList(res.getEvents());
            for (int i = 0; i < events.size(); i++) {
                Event ev1 = events.get(i);
                if (sol.isEventAssigned(ev1))
                    for (int j = i + 1; j < events.size(); j++) {
                        Event ev2 = events.get(j);
                        if (sol.isEventAssigned(ev2) && ev1.overlapps(ev2))
                            if (throwExc)
                                throw new IllegalStateException("conflicting events in resource " +
                                        res + " ev1:" + ev1 + " " + ev1.getLocation() + " ev2:" + ev2 + " " + ev2.getLocation());
                            else
                                counter++;
                    }
            }
        }
View Full Code Here


     */
    public int getEndViolation(TreeMap raster, Map<Event, Integer> problemMap) {

        int counter = 0;
        int end = weekLength;
        Event ti;
        for (int i = dayDuration - 1; i < end; i += dayDuration) {
            ti = (Event) raster.get(i);
            if (ti != null) {
                counter++;
                increaseProblemCounter(problemMap, ti);
View Full Code Here

            UniAssignment ass = (UniAssignment) activity.getBestAssignment();
            if (ass == null) {
                logger.severe("No best assignment found for activity:" + activity.getName());
                continue;
            }
            Event event = eventForActivity.get(activity);
            if (event == null) {
                logger.severe("No event found for activity:" + activity.getName());
                continue;
            }

            event.setStart(ass.getSlot());
            Location tfLoc = locToRoom.getSecond(ass.getResource(0));
            if (tfLoc != null) {
                event.setLocation(tfLoc);
            } else
                logger.warning("No TF-room found for activity:" + activity.getName());
        }
    }
View Full Code Here

        Assignment ass = (Assignment) obj;
        if (ass.getStart() < 0)
            return 0;

        int counter = 0;
        Event ev = ass.getEvent();
        BitRaster refRaster = getRaster().getForbidden();
        int end = ass.getStart() + ev.getDuration();
        for (int i = ass.getStart(); i < end; i++) {
            if (refRaster.isAssigned(i))
                counter++;
        }
        return counter;
View Full Code Here

        this.dataPoolSettings = settings;
    }

    protected void addDiscouragedSlot(UniActivity activity, int day, int hour, int slotsPerDay) {
        if (hour >= slotsPerDay / 2) {
            Event ev = eventForActivity.get(activity);
            float w = hour;
            if (ev != null)
                w += ev.getPersons().size();

            activity.addDiscourage(slotsPerDay * day + hour, w);
        }
    }
View Full Code Here

        return loc;
    }

    public Event createEvent() {
        Event event = new Event();

        //startTime == [0, 45); duration == 1
        event.setDuration(1);
        getEventDao().attach(event);
        event.setName("Event " + event.getId());
        return event;
    }
View Full Code Here

        if (assignments.size() == 0) {
            throw new IllegalArgumentException("There should be more than 0 events to optimize!");
        }

        for (Assignment ass : assignments) {
            Event ev = ass.getEvent();
            RasterConstraint rc = ev.getConstraint(RasterConstraint.class);
            if (rc == null) {
                rasterIsNull++;
                continue;
            }
View Full Code Here

            }
        }
    }

    private Set<Assignment> createFollowsAssignments(Assignment ass, Collection<Assignment> allAssignments) {
        Event event = ass.getEvent();
        EventOrderConstraint oc = event.getConstraint(EventOrderConstraint.class);
        if (oc == null)
            return Collections.EMPTY_SET;

        Set<Assignment> res = FastSet.newInstance();
        for (Event ev : oc.getFollows()) {
View Full Code Here

        }
        return res;
    }

    private Set<Assignment> createBeforesAssignments(Assignment ass, Collection<Assignment> allAssignments) {
        Event event = ass.getEvent();
        EventOrderConstraint oc = event.getConstraint(EventOrderConstraint.class);
        if (oc == null)
            return Collections.EMPTY_SET;

        Set<Assignment> res = FastSet.newInstance();
        for (Event ev : oc.getBefores()) {
View Full Code Here

     */
    List remove(Assignment ass) {
        int startOld = ass.getStart();
        List undoRemoveList = Collections.emptyList();
        if (startOld >= 0) {
            Event ev = ass.getEvent();
            int end = startOld + ev.getDuration();
            undoRemoveList = new ArrayList(end - startOld);
            for (int slot = startOld; slot < end; slot++) {
                Object obj = clusterArray.get(slot).remove(ass);
                if (obj == null)
                    throw new IllegalStateException("Cannot remove assignment:" + ass);
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.