/** * Get the maximum value for this field evaluated at the specified time. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(long instant) { return getMaximumValue(); }
/** * Get the maximum value for this field evaluated at the specified instant. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the partial instant to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(ReadablePartial instant) { return getMaximumValue(); }
/** * Get the maximum value for this field evaluated at the specified instant. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the partial instant to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(ReadablePartial instant) { return getMaximumValue(); }
/** * Get the maximum value for this field using the partial instant and * the specified values. * <p> * This implementation returns the same as {@link #getMaximumValue(ReadablePartial)}. * * @param instant the partial instant to query * @param values the values to use * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(ReadablePartial instant, int[] values) { return getMaximumValue(instant); }
/** * Get the maximum value for this field using the partial instant and * the specified values. * <p> * This implementation returns the same as {@link #getMaximumValue(ReadablePartial)}. * * @param instant the partial instant to query * @param values the values to use * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(ReadablePartial instant, int[] values) { return getMaximumValue(instant); }
/** * Get the maximum value for this field evaluated at the specified time. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(long instant) { return getMaximumValue(); }
/** * Get the maximum text value for this field. The default implementation * returns the equivalent of Integer.toString(getMaximumValue()).length(). * * @param locale the locale to use for selecting a text symbol * @return the maximum text length */ public int getMaximumTextLength(Locale locale) { int max = getMaximumValue(); if (max >= 0) { if (max < 10) { return 1; } else if (max < 100) { return 2; } else if (max < 1000) { return 3; } } return Integer.toString(max).length(); }
/** * Get the maximum text value for this field. The default implementation * returns the equivalent of Integer.toString(getMaximumValue()).length(). * * @param locale the locale to use for selecting a text symbol * @return the maximum text length */ public int getMaximumTextLength(Locale locale) { int max = getMaximumValue(); if (max >= 0) { if (max < 10) { return 1; } else if (max < 100) { return 2; } else if (max < 1000) { return 3; } } return Integer.toString(max).length(); }
int current = values[fieldIndex]; int wrapped = FieldUtils.getWrappedValue (current, valueToAdd, getMinimumValue(instant), getMaximumValue(instant)); return set(instant, fieldIndex, values, wrapped); // adjusts smaller fields
int current = values[fieldIndex]; int wrapped = FieldUtils.getWrappedValue (current, valueToAdd, getMinimumValue(instant), getMaximumValue(instant)); return set(instant, fieldIndex, values, wrapped); // adjusts smaller fields
/** * Adds a value (which may be negative) to the instant value, * wrapping within this field. * <p> * The value will be added to this field. If the value is too large to be * added solely to this field then it wraps. Larger fields are always * unaffected. Smaller fields should be unaffected, except where the * result would be an invalid value for a smaller field. In this case the * smaller field is adjusted to be in range. * <p> * For example, in the ISO chronology:<br> * 2000-08-20 addWrapField six months is 2000-02-20<br> * 2000-08-20 addWrapField twenty months is 2000-04-20<br> * 2000-08-20 addWrapField minus nine months is 2000-11-20<br> * 2001-01-31 addWrapField one month is 2001-02-28<br> * 2001-01-31 addWrapField two months is 2001-03-31<br> * <p> * The default implementation internally calls set. Subclasses are * encouraged to provide a more efficient implementation. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to add to * @param value the value to add, in the units of the field * @return the updated milliseconds */ public long addWrapField(long instant, int value) { int current = get(instant); int wrapped = FieldUtils.getWrappedValue (current, value, getMinimumValue(instant), getMaximumValue(instant)); return set(instant, wrapped); }
/** * Adds a value (which may be negative) to the instant value, * wrapping within this field. * <p> * The value will be added to this field. If the value is too large to be * added solely to this field then it wraps. Larger fields are always * unaffected. Smaller fields should be unaffected, except where the * result would be an invalid value for a smaller field. In this case the * smaller field is adjusted to be in range. * <p> * For example, in the ISO chronology:<br> * 2000-08-20 addWrapField six months is 2000-02-20<br> * 2000-08-20 addWrapField twenty months is 2000-04-20<br> * 2000-08-20 addWrapField minus nine months is 2000-11-20<br> * 2001-01-31 addWrapField one month is 2001-02-28<br> * 2001-01-31 addWrapField two months is 2001-03-31<br> * <p> * The default implementation internally calls set. Subclasses are * encouraged to provide a more efficient implementation. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to add to * @param value the value to add, in the units of the field * @return the updated milliseconds */ public long addWrapField(long instant, int value) { int current = get(instant); int wrapped = FieldUtils.getWrappedValue (current, value, getMinimumValue(instant), getMaximumValue(instant)); return set(instant, wrapped); }
int max = getMaximumValue(instant, values); long proposed = values[fieldIndex] + valueToAdd; if (proposed <= max) { values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
int max = getMaximumValue(instant, values); long proposed = values[fieldIndex] + valueToAdd; if (proposed <= max) { if (fieldIndex == 0) { valueToAdd -= (min - 1) - values[fieldIndex]; values[fieldIndex] = getMaximumValue(instant, values); continue; values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
int max = getMaximumValue(instant, values); long proposed = values[fieldIndex] + valueToAdd; if (proposed <= max) { values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
int max = getMaximumValue(instant, values); long proposed = values[fieldIndex] + valueToAdd; if (proposed <= max) { if (fieldIndex == 0) { valueToAdd -= (min - 1) - values[fieldIndex]; values[fieldIndex] = getMaximumValue(instant, values); continue; values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
/** * Get the maximum value for this field evaluated at the specified time. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(long instant) { return getMaximumValue(); }
/** * Get the maximum value for this field evaluated at the specified instant. * <p> * This implementation returns the same as {@link #getMaximumValue()}. * * @param instant the partial instant to query * @return the maximum value for this field, in the units of the field */ public int getMaximumValue(ReadablePartial instant) { return getMaximumValue(); }
FieldUtils.verifyValueBounds(this, newValue, getMinimumValue(partial, values), getMaximumValue(partial, values)); values[fieldIndex] = newValue;
FieldUtils.verifyValueBounds(this, newValue, getMinimumValue(partial, values), getMaximumValue(partial, values)); values[fieldIndex] = newValue;