MutableInterval anchor = findWithin(repeaters, outerMutableInterval, pointer, options);
return anchor;
}
public static MutableInterval dayOrTime(DateTime dayStart, List<Token> timeTokens, Options options) {
MutableInterval outerMutableInterval = new MutableInterval(dayStart, Time.cloneAndAdd(dayStart, Time.DAY_OF_MONTH, 1));
if (!timeTokens.isEmpty()) {
// /** SUPER HACK MODE FOR TIMES **/
// Tag<?> dayPortionTag = null;
// Tag<?> timeTag = null;
// for (Token token : timeTokens) {
// Tag<?> tempDayPortionTag = token.getTag(RepeaterDayPortion.class);
// if (tempDayPortionTag != null) {
// dayPortionTag = tempDayPortionTag;
// }
//
// Tag<?> tempTimeTag = token.getTag(RepeaterTime.class);
// if (tempTimeTag != null) {
// timeTag = tempTimeTag;
// }
// }
//
// if (timeTag != null && dayPortionTag != null) {
// Tick tick = (Tick)timeTag.getType();
// RepeaterDayPortion.DayPortion dayPortion = (RepeaterDayPortion.DayPortion)dayPortionTag.getType();
// if (tick.intValue() <= (RepeaterDay.DAY_SECONDS / 2)) {
// if (dayPortion == RepeaterDayPortion.DayPortion.PM) {
// if (tick.intValue() == (12 * 60 * 60)) {
// Calendar exactTime = Time.cloneAndAdd(dayStart, Calendar.SECOND, tick.intValue());
// return new MutableInterval(exactTime, exactTime);
// }
// Calendar exactTime = Time.cloneAndAdd(dayStart, Calendar.SECOND, tick.intValue() + RepeaterDay.DAY_SECONDS / 2);
// return new MutableInterval(exactTime, exactTime);
// }
// else if (dayPortion == RepeaterDayPortion.DayPortion.AM) {
// if (tick.intValue() == (12 * 60 * 60)) {
// Calendar exactTime = dayStart;
// return new MutableInterval(exactTime, exactTime);
// }
// Calendar exactTime = Time.cloneAndAdd(dayStart, Calendar.SECOND, tick.intValue());
// return new MutableInterval(exactTime, exactTime);
// }
// }
// }
// /** SUPER HACK MODE FOR TIMES **/
options.setNow(outerMutableInterval.getStart());
MutableInterval time = getAnchor(dealiasAndDisambiguateTimes(timeTokens, options), options);
return time;
}
return outerMutableInterval;
}