public boolean equals(Object o) { if (o == null || !(o instanceof Duration)) { return false; } return compareTo((Duration) o) == 0; }
public String printDuration(Duration pDuration) { return pDuration.toString(); } }
/** Returns a string representation of this Duration. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append('P'); sb.append(getYears()); sb.append('Y'); sb.append(getMonths()); sb.append('M'); sb.append(getDays()); sb.append("DT"); sb.append(getHours()); sb.append('H'); sb.append(getMinutes()); sb.append('M'); sb.append(getSeconds()); long m = getMillis(); if (m != 0) { sb.append('.'); sb.append(m); } sb.append('S'); return sb.toString(); }
return new Duration( isNegative, years == -1 ? 0 : years,
public int compareTo(Object o) { return compareTo((Duration) o); }