List of usage examples for org.joda.time ReadableInterval getStart
DateTime getStart();
From source file:com.helger.datetime.holiday.mgr.AbstractHolidayManager.java
License:Apache License
@Nonnull @ReturnsMutableCopy/* w ww . ja v a2s . co 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 . java 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:com.ning.metrics.serialization.event.Granularity.java
License:Apache License
public List<ReadableDateTime> forwardSteps(ReadableInterval interval) { final List<ReadableDateTime> result = new ArrayList<ReadableDateTime>(); stepThroughInterval(interval, new Callback<RuntimeException>() { @Override/*from w w w . j a va 2 s .co m*/ public void step(ReadableInterval stepInterval) { result.add(stepInterval.getStart()); } }); return result; }
From source file:com.ning.metrics.serialization.event.GranularityPathMapper.java
License:Apache License
public Collection<String> getPathsForInterval(ReadableInterval interval) { final List<String> paths = new ArrayList<String>(); granularity.stepThroughInterval(interval, new Granularity.Callback<RuntimeException>() { public void step(ReadableInterval stepInterval) throws RuntimeException { paths.add(getPathForDateTime(stepInterval.getStart())); }/*from w ww . j a va2 s. com*/ }); return paths; }
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; }