Example usage for org.joda.time LocalDate compareTo

List of usage examples for org.joda.time LocalDate compareTo

Introduction

In this page you can find the example usage for org.joda.time LocalDate compareTo.

Prototype

public int compareTo(ReadablePartial partial) 

Source Link

Document

Compares this partial with another returning an integer indicating the order.

Usage

From source file:org.libreplan.web.orders.ManageOrderElementAdvancesModel.java

License:Open Source License

@Override
public boolean isDistinctValidDate(LocalDate value, AdvanceMeasurement newAdvanceMeasurement) {
    if (this.advanceAssignment == null) {
        return true;
    }/*from   w  w  w.  j  ava  2  s . c  o m*/
    for (AdvanceMeasurement advanceMeasurement : advanceAssignment.getAdvanceMeasurements()) {
        LocalDate oldDate = advanceMeasurement.getDate();
        if (oldDate != null && !newAdvanceMeasurement.equals(advanceMeasurement)
                && oldDate.compareTo(new LocalDate(value)) == 0) {
            return false;
        }
    }
    return true;
}

From source file:org.libreplan.web.orders.ManageOrderElementAdvancesModel.java

License:Open Source License

@Override
public Boolean isAlreadyReportedProgressWith(LocalDate date) {
    if (isSubcontractedByCustomer() && isSubcontractedAdvanceType(advanceAssignment)) {
        LocalDate lastReported = getLastReportedProgressToCustomer();
        return (date != null && lastReported != null && date.compareTo(lastReported) <= 0);
    }/*from  ww  w. j  ava2 s . co  m*/
    return false;
}

From source file:org.libreplan.web.planner.chart.ChartFiller.java

License:Open Source License

protected SortedMap<LocalDate, BigDecimal> calculatedValueForEveryDay(SortedMap<LocalDate, BigDecimal> map,
        LocalDate start, LocalDate finish) {
    SortedMap<LocalDate, BigDecimal> result = new TreeMap<LocalDate, BigDecimal>();

    LocalDate previousDay = start;
    BigDecimal previousValue = BigDecimal.ZERO;

    for (LocalDate day : map.keySet()) {
        BigDecimal value = map.get(day);
        fillValues(result, previousDay, day, previousValue, value);

        previousDay = day;// www . j  ava 2s.co m
        previousValue = value;
    }

    if (previousDay.compareTo(finish) < 0) {
        fillValues(result, previousDay, finish, previousValue, previousValue);
    }

    return result;
}

From source file:org.libreplan.web.planner.chart.EarnedValueChartFiller.java

License:Open Source License

public static boolean includes(Interval interval, LocalDate date) {
    LocalDate start = interval.getStart();
    LocalDate end = interval.getFinish();
    return start.compareTo(date) <= 0 && date.compareTo(end) < 0;
}

From source file:org.libreplan.web.resources.worker.CriterionSatisfactionDTO.java

License:Open Source License

public boolean isPreviousStartDate(LocalDate startDate) {
    if (newObject) {
        return true;
    }/*from  www  .  ja v  a  2s  .  c  om*/
    if (getStartDate() == null || startDate == null) {
        return true;
    }
    if (startDate.compareTo(getCriterionSatisfaction().getStartDate()) <= 0) {
        return true;
    }
    return false;
}

From source file:org.libreplan.web.resources.worker.CriterionSatisfactionDTO.java

License:Open Source License

public boolean isPostEndDate(LocalDate endDate) {
    if (newObject) {
        return true;
    }/*w w w .jav a 2 s  .  com*/
    if (getEndDate() == null || endDate == null) {
        return true;
    }
    if (getCriterionSatisfaction().getEndDate() == null) {
        return true;
    }
    if (endDate.compareTo(getCriterionSatisfaction().getEndDate()) >= 0) {
        return true;
    }
    return false;
}

From source file:org.zkoss.ganttz.data.Task.java

License:Open Source License

public void resizeTo(final LocalDate date) {
    if (date.compareTo(getBeginDateAsLocalDate()) < 0) {
        return;//from w w  w.j  av  a2s. c  om
    }

    doPositionModifications(position1 -> position1.resizeTo(GanttDate.createFrom(date)));
}