Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.EffortDuration.compareTo()


            EffortDuration maximum, ResourcesPerDay resourcesPerDay,
            IntraDayDate start, IntraDayDate end) {
        EffortDuration result = zero();
        for (PartialDay current : start.daysUntil(end)) {
            result = result.plus(calendar.asDurationOn(current, resourcesPerDay));
            if (result.compareTo(maximum) >= 0) {
                return maximum;
            }
        }
        return result;
    }
View Full Code Here


        String rosterCatName = rosterDTOs.get(0).getRosterCategories().get(0)
                .getName();
        for (RosterDTO rosterDTO : rosterDTOs) {
            EffortDuration duration = EffortDuration
                    .parseFromFormattedString(rosterDTO.getDuration());
            if (duration.compareTo(max) > 0) {
                rosterCatName = rosterDTO.getRosterCategories().get(0)
                        .getName();
            }
            max = EffortDuration.max(max, duration);
            sum = EffortDuration.sum(sum, duration);
View Full Code Here

        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

        while (listIterator.hasNext() && durationSurplus.compareTo(zero()) > 0) {
            DayAssignment current = listIterator.next();
            EffortDuration durationTaken = min(durationSurplus,
                    current.getDuration());
            durationSurplus = durationSurplus.minus(durationTaken);
            if (durationTaken.compareTo(current.getDuration()) == 0) {
                listIterator.remove();
            } else {
                listIterator.set(current.withDuration(durationTaken));
            }
        }
View Full Code Here

        // Generate last day assignment
        PartialDay firstDay = new PartialDay(IntraDayDate.startOfDay(date),
                IntraDayDate.create(date, hours(endTime.getHour())));
        EffortDuration effortCanAllocate = min(totalIntended,
                calendar.asDurationOn(firstDay, ONE_RESOURCE_PER_DAY));
        if (effortCanAllocate.compareTo(zero()) > 0) {
            DayAssignment dayAssignment = createDayAssignment(
                    resourceAllocation, resource, date, effortCanAllocate);
            totalIntended = totalIntended.minus(addDayAssignment(result,
                    dayAssignment));
        }
View Full Code Here

    private EffortDuration addOverload(EffortDuration currentOverload,
            Resource resource, EffortDuration loadAtDate, LocalDate date) {
        EffortDuration result;
        EffortDuration capacityAtDay = getCapacityAtDate(resource, date);
        if (capacityAtDay.compareTo(loadAtDate) < 0) {
            result = currentOverload.plus(loadAtDate.minus(capacityAtDay));
        } else {
            result = currentOverload;
        }
View Full Code Here

            return EffortDuration.zero();
        }
        EffortDuration totalAssignedEffort = getTotalAssignedEffort();
        // FIXME Once we're able to reproduce and fix the cause of bugs like
        // #1529, we could remove this if
        if (totalAssignedEffort.compareTo(assignedDirectEffort) < 0) {
            orderElement.getOrder()
                    .markAsNeededToRecalculateSumChargedEfforts();
            return EffortDuration.zero();
        }
        return totalAssignedEffort.minus(this.assignedDirectEffort);
View Full Code Here

    public boolean thereAreMoreSpaceAvailableAt(IntraDayDate date) {
        LocalDate day = date.getDate();
        EffortDuration dayDuration = getBeingModified().getAllocationCalendar()
                .asDurationOn(PartialDay.wholeDay(day), goal);
        return dayDuration.compareTo(date.getEffortDuration()) > 0;
    }

    public EffortDuration durationAtDay(PartialDay day) {
        return getBeingModified().getAllocationCalendar().asDurationOn(day,
                goal);
View Full Code Here

                        .getSumChargedEffort();
                EffortDuration spentEffort = sumChargedEffort == null ? EffortDuration
                        .zero() : sumChargedEffort.getTotalChargedEffort();
                if (!spentEffort.isZero()) {
                    double deviation;
                    if (spentEffort.compareTo(effort) >= 0) {
                        deviation = spentEffort.minus(effort)
                                .dividedByAndResultAsBigDecimal(effort)
                                .doubleValue();
                    } else {
                        deviation = -effort.minus(spentEffort)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.