@Override public Temporal resolve(Time t, int flags) { if (t == null) return this; // No resolving to be done? if (base instanceof PartialTime) { PartialTime pt = (PartialTime) base.resolve(t,flags); List<Temporal> list = pt.toList(); if (list != null && list.size() >= n) { return list.get(n-1); } } else if (base instanceof Duration) { Duration d = ((Duration) base).multiplyBy(n-1); Time temp = t.getRange().begin(); return temp.offset(d,0).reduceGranularityTo(d.getDuration()); } return this; }
@Override public Temporal resolve(Time t, int flags) { if (t == null) return this; // No resolving to be done? if (base instanceof PartialTime) { PartialTime pt = (PartialTime) base.resolve(t,flags); List<Temporal> list = pt.toList(); if (list != null && list.size() >= n) { return list.get(n-1); } } else if (base instanceof Duration) { Duration d = ((Duration) base).multiplyBy(n-1); Time temp = t.getRange().begin(); return temp.offset(d,0).reduceGranularityTo(d.getDuration()); } return this; }
public Temporal resolve(Time t, int flags) { if (t == null) return this; // No resolving to be done? if (base instanceof PartialTime) { PartialTime pt = (PartialTime) base.resolve(t,flags); List<Temporal> list = pt.toList(); if (list != null && list.size() >= n) { return list.get(n-1); } } else if (base instanceof Duration) { Duration d = ((Duration) base).multiplyBy(n-1); Time temp = t.getRange().begin(); return temp.offset(d,0).reduceGranularityTo(d.getDuration()); } return this; }
public Time mid() { if (duration != null && begin != null) { Time b = begin.getRange(RANGE_FLAGS_PAD_SPECIFIED,duration.getGranularity()).begin(); return b.add(duration.divideBy(2)); } else if (duration != null && end != null) { return end.subtract(duration.divideBy(2)); } else if (begin != null && end != null) { // TODO: .... } else if (begin != null) { return begin; } else if (end != null) { return end; } return null; }
public Time mid() { if (duration != null && begin != null) { Time b = begin.getRange(RANGE_FLAGS_PAD_SPECIFIED,duration.getGranularity()).begin(); return b.add(duration.divideBy(2)); } else if (duration != null && end != null) { return end.subtract(duration.divideBy(2)); } else if (begin != null && end != null) { // TODO: .... } else if (begin != null) { return begin; } else if (end != null) { return end; } return null; }
@Override public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }
public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }
public Time mid() { if (duration != null && begin != null) { Time b = begin.getRange(RANGE_FLAGS_PAD_SPECIFIED,duration.getGranularity()).begin(); return b.add(duration.divideBy(2)); } else if (duration != null && end != null) { return end.subtract(duration.divideBy(2)); } else if (begin != null && end != null) { // TODO: .... } else if (begin != null) { return begin; } else if (end != null) { return end; } return null; }
@Override public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }