1 16 package org.joda.time; 17 18 30 public abstract class DurationField implements Comparable { 31 32 37 public abstract DurationFieldType getType(); 38 39 46 public abstract String getName(); 47 48 53 public abstract boolean isSupported(); 54 55 63 public abstract boolean isPrecise(); 64 65 76 public abstract long getUnitMillis(); 77 78 88 public abstract int getValue(long duration); 89 90 98 public abstract long getValueAsLong(long duration); 99 100 114 public abstract int getValue(long duration, long instant); 115 116 129 public abstract long getValueAsLong(long duration, long instant); 130 131 140 public abstract long getMillis(int value); 141 142 150 public abstract long getMillis(long value); 151 152 165 public abstract long getMillis(int value, long instant); 166 167 180 public abstract long getMillis(long value, long instant); 181 182 189 public abstract long add(long instant, int value); 190 191 198 public abstract long add(long instant, long value); 199 200 208 public long subtract(long instant, int value) { 209 if (value == Integer.MIN_VALUE) { 210 return subtract(instant, (long) value); 211 } 212 return add(instant, -value); 213 } 214 215 223 public long subtract(long instant, long value) { 224 if (value == Long.MIN_VALUE) { 225 throw new ArithmeticException ("Long.MIN_VALUE cannot be negated"); 226 } 227 return add(instant, -value); 228 } 229 230 249 public abstract int getDifference(long minuendInstant, long subtrahendInstant); 250 251 270 public abstract long getDifferenceAsLong(long minuendInstant, long subtrahendInstant); 271 272 282 public abstract int compareTo(Object durationField); 283 284 291 293 299 301 308 310 316 public abstract String toString(); 317 318 } 319 | Popular Tags |