Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.ICalendar


        CombinedWorkHours.minOf(emptyArray);
    }

    @Test
    public void returnsTheMinOfCalendars() {
        ICalendar minOf = CombinedWorkHours
                .minOf(hours(4), hours(2), hours(7));
        EffortDuration duration = minOf.getCapacityOn(wholeDay(new LocalDate(
                2000, 3, 3)));
        assertThat(duration, equalTo(EffortDuration.hours(2)));
    }
View Full Code Here


                2000, 3, 3)));
        assertThat(duration, equalTo(EffortDuration.hours(2)));
    }

    private ICalendar hours(int hours) {
        ICalendar result = createNiceMock(ICalendar.class);
        expect(result.getCapacityOn(isA(PartialDay.class))).andReturn(
                EffortDuration.hours(hours));
        replay(result);
        return result;
    }
View Full Code Here

            IAssignedEffortForResource assignedEffortForEachResource,
            List<ResourceWithAssignedDuration> resources) {
        List<ResourceWithAssignedDuration> result = new ArrayList<ResourceWithAssignedDuration>();
        for (ResourceWithAssignedDuration each : resources) {
            Resource resource = each.resource;
            ICalendar calendar = generateCalendarFor(resource);
            Capacity capacityWithOvertime = calendar
                    .getCapacityWithOvertime(date);
            if (capacityWithOvertime.isOverAssignableWithoutLimit()) {
                result.add(each);
            } else {
                EffortDuration durationCanBeAdded = calculateDurationCanBeAdded(
View Full Code Here

            LocalDate date) {
        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;
            final int remainder = alreadyAssignedSeconds % capacityUnits;
View Full Code Here

        if (allocationsOnInterval.isEmpty()) {
            return null;
        }
        EffortDuration result = EffortDuration.zero();
        for (ResourceAllocation<?> each : allocationsOnInterval) {
            ICalendar allocationCalendar = each.getAllocationCalendar();
            result = result.plus(allocationCalendar.getCapacityOn(day));
        }
        return result.divideBy(allocationsOnInterval.size());
    }
View Full Code Here

    private EffortDuration getExtraDurationAtStart(IntraDayDate start) {
        if (start.getEffortDuration().isZero()) {
            return EffortDuration.zero();
        }
        ICalendar calendar = getNullSafeCalendar();
        EffortDuration capacity = calendar.getCapacityOn(PartialDay
                .wholeDay(start.getDate()));
        return capacity.minus(min(start.getEffortDuration(), capacity));
    }
View Full Code Here

        }
        return result;
    }

    private boolean isWorkable(LocalDate day) {
        ICalendar calendar = getCalendar();
        assert calendar != null;
        return !calendar.getCapacityOn(PartialDay.wholeDay(day)).isZero();
    }
View Full Code Here

                @Override
                protected CapacityResult thereAreAvailableHoursFrom(
                        IntraDayDate dateFromWhichToAllocate,
                        ResourcesPerDayModification resourcesPerDayModification,
                        EffortDuration effortToAllocate) {
                    ICalendar calendar = getCalendar(resourcesPerDayModification);
                    ResourcesPerDay resourcesPerDay = resourcesPerDayModification
                            .getGoal();
                    AvailabilityTimeLine availability = resourcesPerDayModification
                            .getAvailability();
                    getDirection().limitAvailabilityOn(availability,
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.ICalendar

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.