Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.IntraDayDate


    public void setIntraDayStartDate(IntraDayDate startDate) {
        if (startDate == null) {
            LOG.error(doNotProvideNullsDiscouragingMessage());
        }
        IntraDayDate previousStart = getIntraDayStartDate();
        IntraDayDate previousEnd = getIntraDayEndDate();
        this.startDate = startDate;
        datesInterceptor.setStartDate(previousStart, previousEnd,
                getIntraDayStartDate());
    }
View Full Code Here


    public void setIntraDayEndDate(IntraDayDate endDate) {
        if (endDate == null) {
            LOG.error(doNotProvideNullsDiscouragingMessage());
        }
        IntraDayDate previousEnd = getIntraDayEndDate();
        this.endDate = endDate;
        datesInterceptor.setNewEnd(previousEnd, this.endDate);
    }
View Full Code Here

    private static List<IntraDayDate> toEndDates(
            Collection<? extends TaskElement> tasksToSave) {
        List<IntraDayDate> result = new ArrayList<IntraDayDate>();
        for (TaskElement taskElement : tasksToSave) {
            IntraDayDate endDate = taskElement.getIntraDayEndDate();
            if (endDate != null) {
                result.add(endDate);
            } else {
                LOG.warn("the task" + taskElement + " has null end date");
            }
View Full Code Here

    private static List<IntraDayDate> toStartDates(
            Collection<? extends TaskElement> tasksToSave) {
        List<IntraDayDate> result = new ArrayList<IntraDayDate>();
        for (TaskElement taskElement : tasksToSave) {
            IntraDayDate startDate = taskElement.getIntraDayStartDate();
            if (startDate != null) {
                result.add(startDate);
            } else {
                LOG.warn("the task" + taskElement + " has null start date");
            }
View Full Code Here

                IntraDayDate.create(tomorrow, halfHour)) < 0);
    }

    @Test
    public void hasMaxAndMinMethods() {
        IntraDayDate a = IntraDayDate.create(today, halfHour);
        IntraDayDate b = IntraDayDate.create(today, oneHour);
        assertThat(IntraDayDate.min(a, b), equalTo(a));
        assertThat(IntraDayDate.max(a, b), equalTo(b));
    }
View Full Code Here

        assertFalse(days.iterator().hasNext());
    }

    @Test
    public void untilTheNextDayReturnsOnePartialDay() {
        IntraDayDate start = IntraDayDate.create(today, zero());
        IntraDayDate end = IntraDayDate.create(tomorrow, zero());
        Iterable<PartialDay> days = start.daysUntil(end);
        assertThat(IntraDayDate.toList(days), delimitedBy(start, end));
    }
View Full Code Here

        assertThat(IntraDayDate.toList(days), delimitedBy(start, end));
    }

    @Test(expected = IllegalArgumentException.class)
    public void untilADayAgo() {
        IntraDayDate start = IntraDayDate.create(today, zero());
        IntraDayDate end = IntraDayDate.create(tomorrow, zero());
        end.daysUntil(start);
    }
View Full Code Here

        end.daysUntil(start);
    }

    @Test
    public void untilTwoDaysLaterReturnsTwoPartialDays() {
        IntraDayDate start = IntraDayDate.create(today, zero());
        IntraDayDate middle = IntraDayDate.create(today.plusDays(1), zero());
        IntraDayDate end = IntraDayDate.create(today.plusDays(2), zero());
        Iterable<PartialDay> days = start.daysUntil(end);
        assertThat(IntraDayDate.toList(days), delimitedBy(start, middle, end));
    }
View Full Code Here

        assertThat(IntraDayDate.toList(days), delimitedBy(start, middle, end));
    }

    @Test
    public void canNowTheNumberOfDaysBetweenTwoDates() {
        IntraDayDate start = IntraDayDate.create(today, zero());
        IntraDayDate end = IntraDayDate.create(today.plusDays(1), zero());
        assertThat(start.numberOfDaysUntil(end), equalTo(1));
        assertThat(
                start.numberOfDaysUntil(IntraDayDate.create(today, hours(8))),
                equalTo(0));
        assertThat(
View Full Code Here

                equalTo(1));
    }

    @Test(expected = IllegalArgumentException.class)
    public void theEndMustBeEqualOrBiggerThanTheStart() {
        IntraDayDate start = IntraDayDate.create(today, zero());
        IntraDayDate end = IntraDayDate.create(today.plusDays(1), zero());
        assertThat(end.numberOfDaysUntil(start), equalTo(1));
    }
View Full Code Here

TOP

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

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.