Package org.libreplan.business.workingday

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


        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


                capacityWithOvertime.getAllowedExtraEffort());
        if (alreadyAssigned.compareTo(maximum) >= 0) {
            return EffortDuration.zero();
        } else {
            return EffortDuration.min(newAddition,
                    maximum.minus(alreadyAssigned));
        }
    }

    private List<ResourceWithDerivedData> withAvailableCapacity(LocalDate date,
            IAssignedEffortForResource assignedEffortForEachResource,
View Full Code Here

    }

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

    @Test
    public void effortDurationCanBeSubstracted() {
        assertThat(hours(2).minus(minutes(120)), equalTo(EffortDuration.zero()));
View Full Code Here

        if (totalAssignedEffort.compareTo(assignedDirectEffort) < 0) {
            orderElement.getOrder()
                    .markAsNeededToRecalculateSumChargedEfforts();
            return EffortDuration.zero();
        }
        return totalAssignedEffort.minus(this.assignedDirectEffort);
    }

    @Override
    @Transactional(readOnly = true)
    public void initOrderElement(OrderElement orderElement) {
View Full Code Here

            return EffortDuration.zero();
        }
        ICalendar calendar = getNullSafeCalendar();
        EffortDuration capacity = calendar.getCapacityOn(PartialDay
                .wholeDay(start.getDate()));
        return capacity.minus(min(start.getEffortDuration(), capacity));
    }

    private ICalendar getNullSafeCalendar() {
        return getCalendar() != null ? getCalendar() : SameWorkHoursEveryDay
                .getDefaultWorkingDay();
View Full Code Here

            while (!decrement.isZero()) {
                resultDay = resultDay.minusDays(1);
                EffortDuration capacity = calendar.getCapacityOn(PartialDay
                        .wholeDay(resultDay));
                result = IntraDayDate.create(resultDay,
                        capacity.minus(min(capacity, decrement)));
                decrement = decrement.minus(min(capacity, decrement));
            }
            return result;
        }
    }
View Full Code Here

                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)
                                .dividedByAndResultAsBigDecimal(effort)
View Full Code Here

            if (previousEffort != null) {
                if (effort.compareTo(previousEffort) >= 0) {
                    effort = effort.minus(previousEffort);
                } else {
                    increase = false;
                    effort = previousEffort.minus(effort);
                }
            }

            if (!effort.isZero()) {
                if (increase) {
View Full Code Here

                            public EffortDuration from(
                                    Entry<Resource, EffortDuration> each) {
                                EffortDuration capacity = calendarCapacityFor(
                                        each.getKey(), wholeDay);
                                EffortDuration assigned = each.getValue();
                                return assigned.minus(min(capacity, assigned));
                            }
                        });
            }
        };
    }
View Full Code Here

            @Override
            public EffortDuration transform(LocalDate day,
                    EffortDuration[] previousValue) {
                EffortDuration result = previousValue[0];
                for (int i = 1; i < previousValue.length; i++) {
                    result = result.minus(EffortDuration.min(previousValue[i],
                            result));
                }
                return result;
            }
        };
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.