private PlainTimestamp handleSameTimes(PlainTimestamp entity) { switch (this.mode) { case ElementOperator.OP_NAV_NEXT: return entity.plus(1, CalendarUnit.DAYS); case ElementOperator.OP_NAV_PREVIOUS: return entity.minus(1, CalendarUnit.DAYS); case ElementOperator.OP_NAV_NEXT_OR_SAME: case ElementOperator.OP_NAV_PREVIOUS_OR_SAME: return entity; default: throw new AssertionError("Unknown: " + this.mode); } }
@Override public PlainTimestamp minusPeriod( PlainTimestamp timepoint, String period, ParseLog plog, AttributeQuery attributes ) { try { return timepoint.minus(Duration.parsePeriod(period)); } catch (ParseException ex) { return null; } }
private PlainTimestamp handleLater(PlainTimestamp entity) { switch (this.mode) { case ElementOperator.OP_NAV_NEXT: case ElementOperator.OP_NAV_NEXT_OR_SAME: return entity.with(this.value); case ElementOperator.OP_NAV_PREVIOUS: case ElementOperator.OP_NAV_PREVIOUS_OR_SAME: return entity.minus(1, CalendarUnit.DAYS).with(this.value); default: throw new AssertionError("Unknown: " + this.mode); } }
@Override public Moment minusPeriod( Moment timepoint, String period, ParseLog plog, AttributeQuery attributes ) { Timezone tz = getTimezone(plog.getRawValues(), attributes); PlainTimestamp tsp = timepoint.toZonalTimestamp(tz.getID()); try { return tsp.minus(Duration.parsePeriod(period)).in(tz); } catch (ParseException ex) { return null; } }
@Override protected TimestampInterval nextInterval() { PlainTimestamp next; Boundary<PlainTimestamp> s; Boundary<PlainTimestamp> e; if (RecurrentTimestampIntervals.this.isBackwards()) { next = this.current.minus(RecurrentTimestampIntervals.this.duration); s = Boundary.ofClosed(next); e = Boundary.ofOpen(this.current); } else { next = this.current.plus(RecurrentTimestampIntervals.this.duration); s = Boundary.ofClosed(this.current); e = Boundary.ofOpen(next); } this.current = next; return TimestampIntervalFactory.INSTANCE.between(s, e); } };
tsp = tsp.minus(1, CalendarUnit.DAYS); } else if (comp < 0) { // happens if sunrise is the start of day tsp = tsp.plus(1, CalendarUnit.DAYS);
tsp = tsp.minus(1, CalendarUnit.DAYS); } else if (comp < 0) { // happens if sunrise is the start of day tsp = tsp.plus(1, CalendarUnit.DAYS);
PlainTime time = tsp.getWallTime(); int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tzid); tsp = tsp.minus(deviation, ClockUnit.SECONDS); C date = tsp.getCalendarDate().transform(family.getChronoType(), variant); return GeneralTimestamp.of(date, time);
@Override protected MomentInterval nextInterval() { PlainTimestamp next; Boundary<Moment> s; Boundary<Moment> e; if (RecurrentMomentIntervals.this.isBackwards()) { next = this.current.minus(RecurrentMomentIntervals.this.duration); s = Boundary.ofClosed(next.at(offset)); e = Boundary.ofOpen(this.current.at(offset)); } else { next = this.current.plus(RecurrentMomentIntervals.this.duration); s = Boundary.ofClosed(this.current.at(offset)); e = Boundary.ofOpen(next.at(offset)); } this.current = next; return MomentIntervalFactory.INSTANCE.between(s, e); } };
PlainTime time = tsp.getWallTime(); int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tzid); tsp = tsp.minus(deviation, ClockUnit.SECONDS); C date = tsp.getCalendarDate().transform(chronology.getChronoType()); return GeneralTimestamp.of(date, time);