Example usage for org.joda.time ReadableInterval getEnd

List of usage examples for org.joda.time ReadableInterval getEnd

Introduction

In this page you can find the example usage for org.joda.time ReadableInterval getEnd.

Prototype

DateTime getEnd();

Source Link

Document

Gets the end of this time interval, which is exclusive, as a DateTime.

Usage

From source file:com.helger.datetime.holiday.mgr.AbstractHolidayManager.java

License:Apache License

@Nonnull
@ReturnsMutableCopy/*www.  java  2 s . c  o m*/
public HolidayMap getHolidays(@Nonnull final ReadableInterval aInterval, @Nullable final String... aArgs) {
    if (aInterval == null)
        throw new NullPointerException("Interval is NULL.");

    final HolidayMap aHolidayMap = new HolidayMap();
    for (int nYear = aInterval.getStart().getYear(); nYear <= aInterval.getEnd().getYear(); nYear++) {
        final HolidayMap yearHolidays = getHolidays(nYear, aArgs);
        for (final Map.Entry<LocalDate, ISingleHoliday> aEntry : yearHolidays.getMap().entrySet())
            if (aInterval.contains(aEntry.getKey().toDateTimeAtStartOfDay()))
                aHolidayMap.add(aEntry.getKey(), aEntry.getValue());
    }
    return aHolidayMap;
}

From source file:com.jjlharrison.jollyday.impl.DefaultHolidayManager.java

License:Apache License

/**
 * {@inheritDoc}/*from   ww w.j  av a  2 s.  c om*/
 *
 * Calls <code>getHolidays(year, args)</code> for each year within the
 * interval and returns a list of holidays which are then contained in the
 * interval.
 */
@Override
public Set<Holiday> getHolidays(ReadableInterval interval, final String... args) {
    if (interval == null) {
        throw new IllegalArgumentException("Interval is NULL.");
    }
    Set<Holiday> holidays = new HashSet<Holiday>();
    for (int year = interval.getStart().getYear(); year <= interval.getEnd().getYear(); year++) {
        Set<Holiday> yearHolidays = getHolidays(year, args);
        for (Holiday h : yearHolidays) {
            if (interval.contains(h.getDate().toDateTimeAtStartOfDay())) {
                holidays.add(h);
            }
        }
    }
    return holidays;
}

From source file:org.agatom.springatom.data.hades.model.appointment.NAppointment.java

License:Open Source License

public NAppointment setInterval(final ReadableInterval duration) {
    this.setBegin(duration.getStart());
    this.setEnd(duration.getEnd());
    return this;
}