| org.joda.time.field.BaseDateTimeField org.joda.time.field.ImpreciseDateTimeField
All known Subclasses: org.joda.time.chrono.BasicMonthOfYearDateTimeField, org.joda.time.chrono.BasicWeekyearDateTimeField, org.joda.time.chrono.BasicYearDateTimeField, org.joda.time.chrono.gj.TestGJDateTimeField,
ImpreciseDateTimeField | abstract public class ImpreciseDateTimeField extends BaseDateTimeField (Code) | | Abstract datetime field class that defines its own DurationField, which
delegates back into this ImpreciseDateTimeField.
This DateTimeField is useful for defining DateTimeFields that are composed
of imprecise durations. If both duration fields are precise, then a
PreciseDateTimeField should be used instead.
When defining imprecise DateTimeFields where a matching DurationField is
already available, just extend BaseDateTimeField directly so as not to
create redundant DurationField instances.
ImpreciseDateTimeField is thread-safe and immutable, and its subclasses must
be as well.
author: Brian S O'Neill See Also: PreciseDateTimeField since: 1.0 |
Method Summary | |
abstract public long | add(long instant, int value) | abstract public long | add(long instant, long value) | abstract public int | get(long instant) | public int | getDifference(long minuendInstant, long subtrahendInstant) Computes the difference between two instants, as measured in the units
of this field. | public long | getDifferenceAsLong(long minuendInstant, long subtrahendInstant) Computes the difference between two instants, as measured in the units
of this field. | final public DurationField | getDurationField() | final protected long | getDurationUnitMillis() | abstract public DurationField | getRangeDurationField() | abstract public long | roundFloor(long instant) | abstract public long | set(long instant, int value) |
iUnitMillis | final long iUnitMillis(Code) | | |
ImpreciseDateTimeField | public ImpreciseDateTimeField(DateTimeFieldType type, long unitMillis)(Code) | | Constructor.
Parameters: type - the field type Parameters: unitMillis - the average duration unit milliseconds |
add | abstract public long add(long instant, int value)(Code) | | |
add | abstract public long add(long instant, long value)(Code) | | |
get | abstract public int get(long instant)(Code) | | |
getDifference | public int getDifference(long minuendInstant, long subtrahendInstant)(Code) | | Computes the difference between two instants, as measured in the units
of this field. Any fractional units are dropped from the result. Calling
getDifference reverses the effect of calling add. In the following code:
long instant = ...
int v = ...
int age = getDifference(add(instant, v), instant);
The value 'age' is the same as the value 'v'.
The default implementation call getDifferenceAsLong and converts the
return value to an int.
Parameters: minuendInstant - the milliseconds from 1970-01-01T00:00:00Z tosubtract from Parameters: subtrahendInstant - the milliseconds from 1970-01-01T00:00:00Z tosubtract off the minuend the difference in the units of this field |
getDifferenceAsLong | public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)(Code) | | Computes the difference between two instants, as measured in the units
of this field. Any fractional units are dropped from the result. Calling
getDifference reverses the effect of calling add. In the following code:
long instant = ...
long v = ...
long age = getDifferenceAsLong(add(instant, v), instant);
The value 'age' is the same as the value 'v'.
The default implementation performs a guess-and-check algorithm using
getDurationField().getUnitMillis() and the add() method. Subclasses are
encouraged to provide a more efficient implementation.
Parameters: minuendInstant - the milliseconds from 1970-01-01T00:00:00Z tosubtract from Parameters: subtrahendInstant - the milliseconds from 1970-01-01T00:00:00Z tosubtract off the minuend the difference in the units of this field |
getDurationUnitMillis | final protected long getDurationUnitMillis()(Code) | | |
roundFloor | abstract public long roundFloor(long instant)(Code) | | |
set | abstract public long set(long instant, int value)(Code) | | |
Methods inherited from org.joda.time.field.BaseDateTimeField | public long add(long instant, int value)(Code)(Java Doc) public long add(long instant, long value)(Code)(Java Doc) public int[] add(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)(Code)(Java Doc) public long addWrapField(long instant, int value)(Code)(Java Doc) public int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)(Code)(Java Doc) public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)(Code)(Java Doc) protected int convertText(String text, Locale locale)(Code)(Java Doc) abstract public int get(long instant)(Code)(Java Doc) public String getAsShortText(long instant, Locale locale)(Code)(Java Doc) final public String getAsShortText(long instant)(Code)(Java Doc) public String getAsShortText(ReadablePartial partial, int fieldValue, Locale locale)(Code)(Java Doc) final public String getAsShortText(ReadablePartial partial, Locale locale)(Code)(Java Doc) public String getAsShortText(int fieldValue, Locale locale)(Code)(Java Doc) public String getAsText(long instant, Locale locale)(Code)(Java Doc) final public String getAsText(long instant)(Code)(Java Doc) public String getAsText(ReadablePartial partial, int fieldValue, Locale locale)(Code)(Java Doc) final public String getAsText(ReadablePartial partial, Locale locale)(Code)(Java Doc) public String getAsText(int fieldValue, Locale locale)(Code)(Java Doc) public int getDifference(long minuendInstant, long subtrahendInstant)(Code)(Java Doc) public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)(Code)(Java Doc) abstract public DurationField getDurationField()(Code)(Java Doc) public int getLeapAmount(long instant)(Code)(Java Doc) public DurationField getLeapDurationField()(Code)(Java Doc) public int getMaximumShortTextLength(Locale locale)(Code)(Java Doc) public int getMaximumTextLength(Locale locale)(Code)(Java Doc) abstract public int getMaximumValue()(Code)(Java Doc) public int getMaximumValue(long instant)(Code)(Java Doc) public int getMaximumValue(ReadablePartial instant)(Code)(Java Doc) public int getMaximumValue(ReadablePartial instant, int[] values)(Code)(Java Doc) abstract public int getMinimumValue()(Code)(Java Doc) public int getMinimumValue(long instant)(Code)(Java Doc) public int getMinimumValue(ReadablePartial instant)(Code)(Java Doc) public int getMinimumValue(ReadablePartial instant, int[] values)(Code)(Java Doc) final public String getName()(Code)(Java Doc) abstract public DurationField getRangeDurationField()(Code)(Java Doc) final public DateTimeFieldType getType()(Code)(Java Doc) public boolean isLeap(long instant)(Code)(Java Doc) final public boolean isSupported()(Code)(Java Doc) public long remainder(long instant)(Code)(Java Doc) public long roundCeiling(long instant)(Code)(Java Doc) abstract public long roundFloor(long instant)(Code)(Java Doc) public long roundHalfCeiling(long instant)(Code)(Java Doc) public long roundHalfEven(long instant)(Code)(Java Doc) public long roundHalfFloor(long instant)(Code)(Java Doc) abstract public long set(long instant, int value)(Code)(Java Doc) public int[] set(ReadablePartial partial, int fieldIndex, int[] values, int newValue)(Code)(Java Doc) public long set(long instant, String text, Locale locale)(Code)(Java Doc) final public long set(long instant, String text)(Code)(Java Doc) public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale)(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|