Package org.joda.time.chrono
Class GJChronology.LinkedDurationField
java.lang.Object
org.joda.time.DurationField
org.joda.time.field.BaseDurationField
org.joda.time.field.DecoratedDurationField
org.joda.time.chrono.GJChronology.LinkedDurationField
- All Implemented Interfaces:
Serializable,Comparable<DurationField>
- Enclosing class:
GJChronology
Links the duration back to a ImpreciseCutoverField.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GJChronology.ImpreciseCutoverFieldprivate static final long -
Constructor Summary
ConstructorsConstructorDescriptionLinkedDurationField(DurationField durationField, GJChronology.ImpreciseCutoverField dateTimeField) -
Method Summary
Modifier and TypeMethodDescriptionlongadd(long instant, int value) Adds a duration value (which may be negative) to the instant.longadd(long instant, long value) Adds a duration value (which may be negative) to the instant.intgetDifference(long minuendInstant, long subtrahendInstant) Computes the difference between two instants, as measured in the units of this field.longgetDifferenceAsLong(long minuendInstant, long subtrahendInstant) Computes the difference between two instants, as measured in the units of this field.Methods inherited from class org.joda.time.field.DecoratedDurationField
getMillis, getMillis, getUnitMillis, getValueAsLong, getWrappedField, isPreciseMethods inherited from class org.joda.time.field.BaseDurationField
compareTo, getMillis, getMillis, getName, getType, getValue, getValue, getValueAsLong, isSupported, toStringMethods inherited from class org.joda.time.DurationField
subtract, subtract
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
iField
-
-
Constructor Details
-
LinkedDurationField
LinkedDurationField(DurationField durationField, GJChronology.ImpreciseCutoverField dateTimeField)
-
-
Method Details
-
add
public long add(long instant, int value) Description copied from class:DurationFieldAdds a duration value (which may be negative) to the instant.- Overrides:
addin classDecoratedDurationField- Parameters:
instant- the milliseconds from 1970-01-01T00:00:00Z to add tovalue- the value to add, in the units of the field- Returns:
- the updated milliseconds
-
add
public long add(long instant, long value) Description copied from class:DurationFieldAdds a duration value (which may be negative) to the instant.- Overrides:
addin classDecoratedDurationField- Parameters:
instant- the milliseconds from 1970-01-01T00:00:00Z to add tovalue- the value to add, in the units of the field- Returns:
- the updated milliseconds
-
getDifference
public int getDifference(long minuendInstant, long subtrahendInstant) Description copied from class:DurationFieldComputes 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'.- Overrides:
getDifferencein classBaseDurationField- Parameters:
minuendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
-
getDifferenceAsLong
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) Description copied from class:DurationFieldComputes 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'.- Overrides:
getDifferenceAsLongin classDecoratedDurationField- Parameters:
minuendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
-