@Override public String toFormattedString(int flags) { if (getTimeLabel() != null) { return getTimeLabel(); } if ((flags & FORMAT_ISO) != 0) { return null; } // TODO: is there iso standard? if ((flags & FORMAT_TIMEX3_VALUE) != 0) { return null; } // TODO: is there timex3 standard? StringBuilder sb = new StringBuilder(); sb.append("~("); if (base != null) { sb.append(base.toFormattedString(flags)); } if (duration != null) { sb.append(":"); sb.append(duration.toFormattedString(flags)); } if (range != null) { sb.append(" IN "); sb.append(range.toFormattedString(flags)); } sb.append(")"); return sb.toString(); }
public String toFormattedString(int flags) { if (getTimeLabel() != null) { return getTimeLabel().isoString; } if ((flags & FORMAT_ISO) != 0) { return null; } // TODO: is there iso standard? if ((flags & FORMAT_TIMEX3_VALUE) != 0) { return null; } // TODO: is there timex3 standard? StringBuilder sb = new StringBuilder(); sb.append("~("); if (base != null) { sb.append(base.toFormattedString(flags)); } if (duration != null) { sb.append(":"); sb.append(duration.toFormattedString(flags)); } if (range != null) { sb.append(" IN "); sb.append(range.toFormattedString(flags)); } sb.append(")"); return sb.toString(); }
public String toFormattedString(int flags) { if (getTimeLabel() != null) { return getTimeLabel(); } if ((flags & FORMAT_ISO) != 0) { return null; } // TODO: is there iso standard? if ((flags & FORMAT_TIMEX3_VALUE) != 0) { return null; } // TODO: is there timex3 standard? StringBuilder sb = new StringBuilder(); sb.append("~("); if (base != null) { sb.append(base.toFormattedString(flags)); } if (duration != null) { sb.append(":"); sb.append(duration.toFormattedString(flags)); } if (range != null) { sb.append(" IN "); sb.append(range.toFormattedString(flags)); } sb.append(")"); return sb.toString(); }
public Time resolve(Time refTime, int flags) { CompositePartialTime cpt = makeComposite(new PartialTime(this, new Partial()), this); if (cpt != null) { return cpt.resolve(refTime, flags); } Time groundedBase = null; if (base == TIME_REF) { groundedBase = refTime; } else if (base != null) { groundedBase = base.resolve(refTime, flags).getTime(); } Range groundedRange = null; if (range != null) { groundedRange = range.resolve(refTime, flags).getRange(); } /* if (groundedRange == range && groundedBase == base) { return this; } */ final TimeLabel tl = getTimeLabel(); InexactTime t = new InexactTime(groundedBase, duration, groundedRange) { public TimeLabel getTimeLabel() { return tl; } }; t.mod = mod; return t; }
@Override public String toFormattedString(int flags) { if (getTimeLabel() != null) { return getTimeLabel(); } if ((flags & FORMAT_ISO) != 0) { return null; } // TODO: is there iso standard? if ((flags & FORMAT_TIMEX3_VALUE) != 0) { return null; } // TODO: is there timex3 standard? StringBuilder sb = new StringBuilder(); sb.append("~("); if (base != null) { sb.append(base.toFormattedString(flags)); } if (duration != null) { sb.append(":"); sb.append(duration.toFormattedString(flags)); } if (range != null) { sb.append(" IN "); sb.append(range.toFormattedString(flags)); } sb.append(")"); return sb.toString(); }
public Time add(Duration offset) { if (getTimeLabel() != null) { // Time has some meaning, keep as is return new RelativeTime(this, TemporalOp.OFFSET, offset); } else { // Some other time, who know what it means // Try to do offset return new InexactTime(this, (Time) TemporalOp.OFFSET.apply(base, offset), duration, (Range) TemporalOp.OFFSET.apply(range, offset)); } }