Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.EffortDuration


        return advanceAssignment.getLastAdvanceMeasurement();
    }

    public String getEffortAsString() {
        SumChargedEffort sumChargedEffort = getSumChargedEffort();
        EffortDuration effort = sumChargedEffort != null ? sumChargedEffort
                .getTotalChargedEffort() : EffortDuration.zero();
        return effort.toFormattedString();
    }
View Full Code Here


                LocalDate date = day.getDate();
                Capacity capacity = answersForDates.containsKey(date) ? answersForDates
                        .get(date) : defaultAnswer;

                EffortDuration oneResourcePerDayWorkingDuration = day
                        .limitWorkingDay(capacity.getStandardEffort());
                EffortDuration amountRequestedDuration = resourcesPerDay
                        .asDurationGivenWorkingDayOf(oneResourcePerDayWorkingDuration);
                return capacity.limitDuration(amountRequestedDuration);
            }
        };
        expect(
View Full Code Here

            PartialDay day, EffortDuration totalDuration) {
        List<ResourceWithDerivedData> resourcesAssignable = resourcesAssignableAt(day
                .getDate());
        List<ResourceWithAssignedDuration> withoutOvertime = assignAllPossibleWithoutOvertime(
                day, totalDuration, resourcesAssignable);
        EffortDuration remaining = totalDuration
                .minus(ResourceWithAssignedDuration
                        .sumDurations(withoutOvertime));
        if (remaining.isZero()) {
            return withoutOvertime;
        }
        List<ResourceWithAssignedDuration> withOvertime = distributeInOvertimeForDayRemainingEffort(
                day.getDate(), remaining,
                ResourceWithAssignedDuration.sumAssignedEffort(withoutOvertime,
View Full Code Here

            PartialDay day, EffortDuration totalDuration,
            List<ResourceWithDerivedData> resourcesAssignable) {

        List<ResourceWithAvailableCapacity> fromMoreToLessCapacity = resourcesFromMoreDesirableToLess(
                resourcesAssignable, day);
        EffortDuration remaining = totalDuration;
        List<ResourceWithAssignedDuration> result = new ArrayList<ResourceWithAssignedDuration>();
        for (ResourceWithAvailableCapacity each : fromMoreToLessCapacity) {
            if (!each.available.isZero()) {
                ResourceWithAssignedDuration r = each
                        .doBiggestAssignationPossible(remaining);
                remaining = remaining.minus(r.duration);
                if (!r.duration.isZero()) {
                    result.add(r);
                }
            }
        }
View Full Code Here

                day,
                assignedEffortForEachResource,
                distributeRemaining(day, remainingDuration,
                        assignedEffortForEachResource, assignableResources));

        EffortDuration durationDistributed = ResourceWithAssignedDuration
                .sumDurations(remainingDistribution);
        EffortDuration newRemaining = remainingDuration
                .minus(durationDistributed);
        assert newRemaining.compareTo(EffortDuration.zero()) >= 0;
        if (newRemaining.isZero()) {
            return remainingDistribution;
        }
        IAssignedEffortForResource newEffortForEachResource = ResourceWithAssignedDuration.sumAssignedEffort(
                remainingDistribution, assignedEffortForEachResource);
View Full Code Here

            Capacity capacityWithOvertime = calendar
                    .getCapacityWithOvertime(date);
            if (capacityWithOvertime.isOverAssignableWithoutLimit()) {
                result.add(each);
            } else {
                EffortDuration durationCanBeAdded = calculateDurationCanBeAdded(
                        assignedEffortForEachResource.getAssignedDurationAt(
                                resource, date), capacityWithOvertime,
                        each.duration);
                if (!durationCanBeAdded.isZero()) {
                    result.add(new ResourceWithAssignedDuration(
                            durationCanBeAdded, resource));
                }
            }
        }
View Full Code Here

    }

    private EffortDuration calculateDurationCanBeAdded(
            EffortDuration alreadyAssigned, Capacity capacityWithOvertime,
            EffortDuration newAddition) {
        EffortDuration maximum = capacityWithOvertime.getStandardEffort().plus(
                capacityWithOvertime.getAllowedExtraEffort());
        if (alreadyAssigned.compareTo(maximum) >= 0) {
            return EffortDuration.zero();
        } else {
            return EffortDuration.min(newAddition,
                    maximum.minus(alreadyAssigned));
        }
    }
View Full Code Here

            IAssignedEffortForResource assignedEffortForEachResource,
            List<ResourceWithDerivedData> assignableResources) {
        List<ResourceWithDerivedData> result = new ArrayList<ResourceWithDerivedData>();
        for (ResourceWithDerivedData each : assignableResources) {
            Capacity capacity = each.calendar.getCapacityWithOvertime(date);
            EffortDuration assignedEffort = assignedEffortForEachResource
                    .getAssignedDurationAt(each.resource, date);
            if (capacity.hasSpareSpaceForMoreAllocations(assignedEffort)) {
                result.add(each);
            }
        }
View Full Code Here

        List<ShareSource> result = new ArrayList<ShareSource>();
        for (int i = 0; i < resources.size(); i++) {
            List<Share> shares = new ArrayList<Share>();
            Resource resource = resources.get(i).resource;
            ICalendar calendarForResource = resources.get(i).calendar;
            EffortDuration alreadyAssigned = assignedEffortForEachResource
                    .getAssignedDurationAt(resource, date);
            final int alreadyAssignedSeconds = alreadyAssigned.getSeconds();
            Integer capacityEachOneSeconds = calendarForResource.asDurationOn(
                    PartialDay.wholeDay(date), ONE).getSeconds();
            final int capacityUnits = resources.get(i).capacityUnits;
            assert capacityUnits >= 1;
            final int assignedForEach = alreadyAssignedSeconds / capacityUnits;
View Full Code Here

            this.resource = resource;
        }

        public static EffortDuration sumDurations(
                List<ResourceWithAssignedDuration> withoutOvertime) {
            EffortDuration result = EffortDuration.zero();
            for (ResourceWithAssignedDuration each : withoutOvertime) {
                result = result.plus(each.duration);
            }
            return result;
        }
View Full Code Here

TOP

Related Classes of org.libreplan.business.workingday.EffortDuration

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.