/** * Sets a value in the milliseconds supplied from a human-readable, text value. * <p> * This implementation uses {@link #set(long, String, Locale)}. * <p> * Note: subclasses that override this method should also override getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public final long set(long instant, String text) { return set(instant, text, null); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * <p> * This implementation uses {@link #set(long, String, Locale)}. * <p> * Note: subclasses that override this method should also override getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public final long set(long instant, String text) { return set(instant, text, null); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(ReadablePartial, int, int[], int)}. * * @param instant the partial instant * @param fieldIndex the index of this field in the instant * @param values the values of the partial instant which should be updated * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the passed in values * @throws IllegalArgumentException if the text value is invalid */ public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale) { int value = convertText(text, locale); return set(instant, fieldIndex, values, value); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(long, int)}. * <p> * Note: subclasses that override this method should also override * getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public long set(long instant, String text, Locale locale) { int value = convertText(text, locale); return set(instant, value); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(long, int)}. * <p> * Note: subclasses that override this method should also override * getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public long set(long instant, String text, Locale locale) { int value = convertText(text, locale); return set(instant, value); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(ReadablePartial, int, int[], int)}. * * @param instant the partial instant * @param fieldIndex the index of this field in the instant * @param values the values of the partial instant which should be updated * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the passed in values * @throws IllegalArgumentException if the text value is invalid */ public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale) { int value = convertText(text, locale); return set(instant, fieldIndex, values, value); }
int wrapped = FieldUtils.getWrappedValue (current, valueToAdd, getMinimumValue(instant), getMaximumValue(instant)); return set(instant, fieldIndex, values, wrapped); // adjusts smaller fields
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); }
return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * <p> * This implementation uses {@link #set(long, String, Locale)}. * <p> * Note: subclasses that override this method should also override getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public final long set(long instant, String text) { return set(instant, text, null); }
return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(ReadablePartial, int, int[], int)}. * * @param instant the partial instant * @param fieldIndex the index of this field in the instant * @param values the values of the partial instant which should be updated * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the passed in values * @throws IllegalArgumentException if the text value is invalid */ public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale) { int value = convertText(text, locale); return set(instant, fieldIndex, values, value); }
/** * Sets a value in the milliseconds supplied from a human-readable, text value. * If the specified locale is null, the default locale is used. * <p> * This implementation uses <code>convertText(String, Locale)</code> and * {@link #set(long, int)}. * <p> * Note: subclasses that override this method should also override * getAsText. * * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in * @param text the text value to set * @param locale the locale to use for selecting a text symbol, null for default * @return the updated milliseconds * @throws IllegalArgumentException if the text value is invalid */ public long set(long instant, String text, Locale locale) { int value = convertText(text, locale); return set(instant, value); }
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); }
return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields