Example usage for org.joda.time Partial compareTo

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

Introduction

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

Prototype

public int compareTo(ReadablePartial other) 

Source Link

Document

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

Usage

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.coordinator.tutor.MonthYearsProviderTutorshipManagement.java

License:Open Source License

@Override
public Object provide(Object source, Object currentValue) {

    List<String> result = new ArrayList<String>();

    ChangeTutorshipBean tutorshipBean = (ChangeTutorshipBean) source;

    Partial startMonthYear = tutorshipBean.getTutorship().getStartDate();
    startMonthYear = startMonthYear.plus(Period.years(2));

    Partial endMonthYear = startMonthYear.plus(Period.years(Tutorship.TUTORSHIP_MAX_PERIOD));

    while (startMonthYear.compareTo(endMonthYear) < 0) {
        String line = tutorshipBean.generateMonthYearOption(startMonthYear.get(DateTimeFieldType.monthOfYear()),
                startMonthYear.get(DateTimeFieldType.year()));
        result.add(line);/*from  ww  w. j  a  va  2  s.  co m*/

        startMonthYear = startMonthYear.plus(Period.months(1));
    }

    return result;
}

From source file:se.inera.intyg.intygstjanst.persistence.model.dao.impl.DateFilter.java

License:Open Source License

/**
 * Checks if date is within interval (from, to).
 *
 * @param date date to check/* w w  w .  jav a  2s  .  c om*/
 * @param from first date in interval
 * @param to last date in interval
 *
 * @return true if date is within interval
 */
private boolean isWithin(Partial date, LocalDate from, LocalDate to) {
    if (date == null) {
        return true;
    }
    return date.compareTo(from) >= 0 && date.compareTo(to) <= 0;
}