public Period toPeriod() { Period rslt = new Period( lowClosed ? low : low.addMilliseconds(1), highClosed ? high : high.subtractMilliseconds(1)); return rslt; }
/** * Returns an IntervalOfTime that has both endpoints closed. If the low endpoint is open it will * move it forward by one millisecond. If the high endpoint is closed, it will move it backward by * one millisecond. * * @return an IntervalOfTime with closed endpoints baed on the endpoints of this interval. */ public IntervalOfTime toClosed() { PointInTime t1 = getLow(); if (!isLowClosed()) { t1 = t1.addMilliseconds(1); } PointInTime t2 = getHigh(); if (!isHighClosed()) { t2 = t2.subtractMilliseconds(1); } return new IntervalOfTime(t1, t2, true, true); }
public Period toPeriod(PeriodType periodType) { return new Period( lowClosed ? low : low.addMilliseconds(1), highClosed ? high : high.subtractMilliseconds(1), periodType); }