Package org.libreplan.business.planner.limiting.entities

Examples of org.libreplan.business.planner.limiting.entities.InsertionRequirements


    @Override
    public List<LimitingResourceQueueElement> assignLimitingResourceQueueElement(
            LimitingResourceQueueElement externalQueueElement) {

        InsertionRequirements requirements = queuesState
                .getRequirementsFor(externalQueueElement);
        AllocationSpec allocation = insertAtGap(requirements);
        if (allocation == null) {
            return Collections.emptyList();
        }
        applyAllocation(allocation);

        assert allocation.isValid();
        List<LimitingResourceQueueElement> result = new ArrayList<LimitingResourceQueueElement>();
        result.add(requirements.getElement());

        List<LimitingResourceQueueElement> moved = shift(
                queuesState
                        .getPotentiallyAffectedByInsertion(externalQueueElement),
                requirements.getElement(), allocation);
        result.addAll(rescheduleAffectedElementsToSatisfyDependencies(allocation, moved));

        return result;
    }
View Full Code Here


        }
        if (current.getStartTime().compareTo(newStart) == 0
                && current.getEndTime().compareTo(newEnd) == 0) {
            return null;
        }
        InsertionRequirements requirements = InsertionRequirements.create(
                current, newStart, newEnd);
        GapOnQueue gap = Gap.untilEnd(current, newStart).onQueue(
                current.getLimitingResourceQueue());
        AllocationSpec result = requirements.guessValidity(gap);
        assert result.isValid();
        return result;
    }
View Full Code Here

            final LimitingResourceQueue queue,
            final DateAndHour startAt,
            final DateAndHour endsAfter) {

        // Check if allocation is possible
        InsertionRequirements requirements = queuesState.getRequirementsFor(
                element, startAt);
        AllocationSpec allocation = insertAtGap(requirements, queue);
        if (!allocation.isValid()) {
            return Collections.emptyList();
        }

        // Do allocation
        applyAllocation(allocation, new IDayAssignmentBehaviour() {

            @Override
            public void allocateDayAssigments(IntraDayDate start,
                    IntraDayDate end) {

                List<DayAssignment> assignments = LimitingResourceAllocator
                        .generateDayAssignments(
                                element.getResourceAllocation(),
                                queue.getResource(), startAt, endsAfter);
                element.getResourceAllocation().allocateLimitingDayAssignments(
                        assignments, start, end);
            }

        });

        assert allocation.isValid();

        // Move other tasks to respect dependency constraints
        List<LimitingResourceQueueElement> result = new ArrayList<LimitingResourceQueueElement>();
        result.add(requirements.getElement());

        List<LimitingResourceQueueElement> moved = shift(
                queuesState.getPotentiallyAffectedByInsertion(element),
                requirements.getElement(), allocation);
        result.addAll(rescheduleAffectedElementsToSatisfyDependencies(allocation, moved));

        return result;
    }
View Full Code Here

        Set<LimitingResourceQueueElement> result = new HashSet<LimitingResourceQueueElement>();

        LimitingResourceQueue queue = queuesState.getEquivalent(_queue);
        LimitingResourceQueueElement element = queuesState.getEquivalent(_element);

        InsertionRequirements requirements = queuesState
                .getRequirementsFor(element, allocationTime);

        if (element.getLimitingResourceQueue() != null) {
            unschedule(element);
        }
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.limiting.entities.InsertionRequirements

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.