public long set(long millis, int value) { FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue()); if (value <= iSkip) { value--; } return super.set(millis, value); }
/** * Does a bounds check before setting the value. * * @throws IllegalArgumentException if the value is invalid */ public long set(long instant, int value) { FieldUtils.verifyValueBounds (this, value, getMinimumValue(instant), getMaximumValue(instant)); return super.set(instant, value); } }
/** * Add to the scaled component of the specified time instant, * wrapping around within that component if necessary. * * @param instant the time instant in millis to update. * @param amount the amount of scaled units to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax)); }
/** * Set the specified amount of units to the specified time instant. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @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, getMinimumValue(), getMaximumValue()); return instant + (value - get(instant)) * iUnitMillis; }
@Override public DateTimeField getField(Chronology chronology) { return new OffsetDateTimeField(new DividedDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), QUARTER_OF_YEAR, 3), 1); }
/** * Set the specified amount of units to the specified time instant. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @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, getMinimumValue(), getMaximumValueForSet(instant, value)); return instant + (value - get(instant)) * iUnitMillis; }
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Add to the offset component of the specified time instant, * wrapping around within that component if necessary. * * @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 addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax)); }
/** * 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, int amount) { instant = super.add(instant, amount); FieldUtils.verifyValueBounds(this, get(instant), iMin, iMax); return instant; }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
/** * Get the millisecond duration of this field from its value, which is * approximate if this field is imprecise. * * @param value the value of the field, which may be negative * @return the milliseconds that the field represents, which may be * negative */ public long getMillis(long value) { return FieldUtils.safeMultiply(value, getUnitMillis()); }
/** * 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); }
/** * Set the specified amount of units to the specified time instant. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @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, getMinimumValue(), getMaximumValue()); return instant + (value - get(instant)) * iUnitMillis; }
/** * Does a bounds check before setting the value. * * @throws IllegalArgumentException if the value is invalid */ public long set(long instant, int value) { FieldUtils.verifyValueBounds (this, value, getMinimumValue(instant), getMaximumValue(instant)); return super.set(instant, value); } }
public long set(long millis, int value) { FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue()); if (value <= iSkip) { value--; } return super.set(millis, value); }
/** * Add to the scaled component of the specified time instant, * wrapping around within that component if necessary. * * @param instant the time instant in millis to update. * @param amount the amount of scaled units to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax)); }
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Add to the offset component of the specified time instant, * wrapping around within that component if necessary. * * @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 addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax)); }
/** * 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; }
/** * 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); }