Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.EffortDuration


                equalTo(3));
    }

    @Test(expected = IllegalArgumentException.class)
    public void effortDurationCannotBeSubstractedIfMinuedIsSmallerThanSubtrahend() {
        EffortDuration threeHours = hours(3);
        threeHours.minus(threeHours.and(1, Granularity.SECONDS));
    }
View Full Code Here


        assertThat(hours(2).minus(minutes(60)), equalTo(hours(1)));
    }

    @Test
    public void canConvertToDecimalHours() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
        assertThat(duration.toHoursAsDecimalWithScale(1), equalTo(new BigDecimal("1.5")));
    }
View Full Code Here

    private CalendarExceptionTypeConverter() {
    }

    public final static CalendarExceptionTypeDTO toDTO(
            CalendarExceptionType calendarExceptionType) {
        EffortDuration duration = calendarExceptionType.getDuration();
        int seconds = (duration != null) ? duration.getSeconds() : 0;

        CalendarExceptionTypeColorDTO colorDTO = CalendarExceptionTypeColorConverter
                .toDTO(calendarExceptionType.getColor());

        return new CalendarExceptionTypeDTO(calendarExceptionType.getCode(),
View Full Code Here

    private List<SpecificDayAssignment> assignmentsForEfforts(
            List<DayAssignment> assignments, EffortDuration[] newEffortsPerDay) {
        List<SpecificDayAssignment> result = new ArrayList<SpecificDayAssignment>();
        int i = 0;
        for (DayAssignment each : assignments) {
            EffortDuration durationForAssignment = newEffortsPerDay[i++];
            result.add(SpecificDayAssignment.create(each.getDay(),
                    durationForAssignment, resource));
        }
        return result;
    }
View Full Code Here

        return divide(totalProgress, totalNumHours);
    }

    private BigDecimal calculateTheoreticalAdvanceByNumHoursForCriticalPath(
            List<Task> criticalPath, Date limit) {
        EffortDuration theoreticalCompletedTime = EffortDuration.zero();
        EffortDuration totalAssignedTime = EffortDuration.zero();

        for (Task each: criticalPath) {
            theoreticalCompletedTime = EffortDuration.sum(
                    theoreticalCompletedTime,
                    each.getTheoreticalCompletedTimeUntilDate(limit));
View Full Code Here

        this.dayAssignments = new HashSet<DayAssignment>(
                assignments);
    }

    public EffortDuration getTotalTime() {
        EffortDuration sum = EffortDuration.zero();
        for (DayAssignment dayAssignment : dayAssignments) {
            sum = EffortDuration.sum(sum, dayAssignment.getDuration());
        }
        return sum;
    }
View Full Code Here

        return false;
    }

    @Override
    public EffortDuration getTheoreticalCompletedTimeUntilDate(Date date) {
        EffortDuration sum = EffortDuration.zero();
        for (TaskElement each: taskElements) {
            sum = EffortDuration.sum(sum, each.getTheoreticalCompletedTimeUntilDate(date));
        }
        return sum;
    }
View Full Code Here

                        "Order-element for \"{0}\" issue not found",
                        issue.getKey()));
                continue;
            }

            EffortDuration loggedHours = getLoggedHours(issue.getFields()
                    .getTimetracking());
            EffortDuration estimatedHours = getEstimatedHours(issue.getFields()
                    .getTimetracking(), loggedHours);

            if (estimatedHours.isZero()) {
                synchronizationInfo.addFailedReason(_(
                                "Estimated time for \"{0}\" issue is 0",
                                issue.getKey()));
                continue;
            }

            syncHoursGroup(orderLine, code, estimatedHours.getHours());

            syncProgressMeasurement(orderLine, issue, estimatedHours,
                    loggedHours);
        }
View Full Code Here

    public static Capacity sum(Capacity... capacities) {
        return sum(Arrays.asList(capacities));
    }

    public static Capacity sum(Collection<? extends Capacity> capacities) {
        EffortDuration standard = EffortDuration.zero();
        EffortDuration extra = EffortDuration.zero();
        for (Capacity each : capacities) {
            standard = standard.plus(each.getStandardEffort());
            extra = extra == null || each.isOverAssignableWithoutLimit() ? null
                    : extra.plus(each.getAllowedExtraEffort());
        }
        return Capacity.create(standard).withAllowedExtraEffort(extra);
    }
View Full Code Here

    public Capacity minus(EffortDuration assignment) {
        if (!hasSpareSpaceForMoreAllocations(assignment)) {
            return noCapacity();
        }

        EffortDuration newStandard = standardEffort.minus(EffortDuration.min(
                assignment, standardEffort));
        EffortDuration pending = assignment.minus(EffortDuration.min(
                standardEffort, assignment));
        EffortDuration newExtra = allowedExtraEffort == null ? null
                : allowedExtraEffort.minus(EffortDuration.min(pending,
                        allowedExtraEffort));
        return Capacity.create(newStandard).withAllowedExtraEffort(newExtra);

    }
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.