public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); }
public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); }
/** * Adds to the value of this field in a copy of this TimeOfDay, * wrapping to what would be the next day if necessary. * <p> * The value will be added to this field. If the value is too large to be * added solely to this field then it will affect larger fields. * Smaller fields are unaffected. * <p> * If the result would be too large, beyond 23:59:59:999, then the * calculation wraps to 00:00:00.000. For the alternate strict behaviour * with no wrapping see {@link #addNoWrapToCopy(int)}. * <p> * The TimeOfDay attached to this property is unchanged by this call. * Instead, a new instance is returned. * * @param valueToAdd the value to add to the field in the copy * @return a copy of the TimeOfDay with the field value changed * @throws IllegalArgumentException if the value isn't valid */ public TimeOfDay addToCopy(int valueToAdd) { int[] newValues = iTimeOfDay.getValues(); newValues = getField().addWrapPartial(iTimeOfDay, iFieldIndex, newValues, valueToAdd); return new TimeOfDay(iTimeOfDay, newValues); }
/** * Adds to the value of this field in a copy of this TimeOfDay, * wrapping to what would be the next day if necessary. * <p> * The value will be added to this field. If the value is too large to be * added solely to this field then it will affect larger fields. * Smaller fields are unaffected. * <p> * If the result would be too large, beyond 23:59:59:999, then the * calculation wraps to 00:00:00.000. For the alternate strict behaviour * with no wrapping see {@link #addNoWrapToCopy(int)}. * <p> * The TimeOfDay attached to this property is unchanged by this call. * Instead, a new instance is returned. * * @param valueToAdd the value to add to the field in the copy * @return a copy of the TimeOfDay with the field value changed * @throws IllegalArgumentException if the value isn't valid */ public TimeOfDay addToCopy(int valueToAdd) { int[] newValues = iTimeOfDay.getValues(); newValues = getField().addWrapPartial(iTimeOfDay, iFieldIndex, newValues, valueToAdd); return new TimeOfDay(iTimeOfDay, newValues); }
/** * Gets a copy of this Partial with the value of the specified field increased. * If this partial does not support the field, an exception is thrown. * <p> * If the addition is zero, then <code>this</code> is returned. * The addition will overflow into larger fields (eg. minute to hour). * If the maximum is reached, the addition will wrap. * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new Partial(this, newValues); }
/** * Returns a copy of this time with the value of the specified field increased, * wrapping to what would be a new day if required. * <p> * If the addition is zero, then <code>this</code> is returned. * <p> * These three lines are equivalent: * <pre> * TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6); * TimeOfDay added = tod.plusMinutes(6); * TimeOfDay added = tod.minuteOfHour().addToCopy(6); * </pre> * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new TimeOfDay(this, newValues); }
/** * Gets a copy of this Partial with the value of the specified field increased. * If this partial does not support the field, an exception is thrown. * <p> * If the addition is zero, then <code>this</code> is returned. * The addition will overflow into larger fields (eg. minute to hour). * If the maximum is reached, the addition will wrap. * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new Partial(this, newValues); }
/** * Returns a copy of this time with the value of the specified field increased, * wrapping to what would be a new day if required. * <p> * If the addition is zero, then <code>this</code> is returned. * <p> * These three lines are equivalent: * <pre> * TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6); * TimeOfDay added = tod.plusMinutes(6); * TimeOfDay added = tod.minuteOfHour().addToCopy(6); * </pre> * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new TimeOfDay(this, newValues); }
int index = indexOf(fieldType); if (index >= 0) { newValues = getField(index).addWrapPartial(this, index, newValues, FieldUtils.safeMultiply(period.getValue(i), scalar));
values = nextField.addWrapPartial(instant, fieldIndex - 1, values, 1); // add 1 to next bigger field values = nextField.addWrapPartial(instant, fieldIndex - 1, values, -1); // subtract 1 from next bigger field
public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); }
int index = indexOf(fieldType); if (index >= 0) { newValues = getField(index).addWrapPartial(this, index, newValues, FieldUtils.safeMultiply(period.getValue(i), scalar));
values = nextField.addWrapPartial(instant, fieldIndex - 1, values, 1); // add 1 to next bigger field values = nextField.addWrapPartial(instant, fieldIndex - 1, values, -1); // subtract 1 from next bigger field
/** * Adds to the value of this field in a copy of this TimeOfDay, * wrapping to what would be the next day if necessary. * <p> * The value will be added to this field. If the value is too large to be * added solely to this field then it will affect larger fields. * Smaller fields are unaffected. * <p> * If the result would be too large, beyond 23:59:59:999, then the * calculation wraps to 00:00:00.000. For the alternate strict behaviour * with no wrapping see {@link #addNoWrapToCopy(int)}. * <p> * The TimeOfDay attached to this property is unchanged by this call. * Instead, a new instance is returned. * * @param valueToAdd the value to add to the field in the copy * @return a copy of the TimeOfDay with the field value changed * @throws IllegalArgumentException if the value isn't valid */ public TimeOfDay addToCopy(int valueToAdd) { int[] newValues = iTimeOfDay.getValues(); newValues = getField().addWrapPartial(iTimeOfDay, iFieldIndex, newValues, valueToAdd); return new TimeOfDay(iTimeOfDay, newValues); }
/** * Gets a copy of this Partial with the value of the specified field increased. * If this partial does not support the field, an exception is thrown. * <p> * If the addition is zero, then <code>this</code> is returned. * The addition will overflow into larger fields (eg. minute to hour). * If the maximum is reached, the addition will wra. * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new Partial(this, newValues); }
/** * Returns a copy of this time with the value of the specified field increased, * wrapping to what would be a new day if required. * <p> * If the addition is zero, then <code>this</code> is returned. * <p> * These three lines are equivalent: * <pre> * TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6); * TimeOfDay added = tod.plusMinutes(6); * TimeOfDay added = tod.minuteOfHour().addToCopy(6); * </pre> * * @param fieldType the field type to add to, not null * @param amount the amount to add * @return a copy of this instance with the field updated * @throws IllegalArgumentException if the value is null or invalid * @throws ArithmeticException if the new datetime exceeds the capacity */ public TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).addWrapPartial(this, index, newValues, amount); return new TimeOfDay(this, newValues); }
public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); }
public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); }
values = nextField.addWrapPartial(instant, fieldIndex - 1, values, 1); // add 1 to next bigger field values = nextField.addWrapPartial(instant, fieldIndex - 1, values, -1); // subtract 1 from next bigger field
int index = indexOf(fieldType); if (index >= 0) { newValues = getField(index).addWrapPartial(this, index, newValues, FieldUtils.safeMultiply(period.getValue(i), scalar));