public long set(long instant, int value) { int max = getMaximumValue(); FieldUtils.verifyValueBounds(this, value, 1, max); if (value == max) { value = 0; } return getWrappedField().set(instant, value); }
/** * Set the specified amount of offset units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, iMin, iMax); return super.set(instant, value - iOffset); }
/** * Add the specified amount of offset units to the specified time instant. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount of units to add (can be negative). * @return the updated time instant. */ public long add(long instant, long amount) { instant = super.add(instant, amount); FieldUtils.verifyValueBounds(this, get(instant), iMin, iMax); return instant; }