|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.time.calendar.zone.ZoneOffsetTransition
public final class ZoneOffsetTransition
A transition between two offsets caused by a discontinuity in the local time-line.
A transition between two offsets is normally the result of a daylight savings cutover.
The discontinuity is normally a gap in spring and an overlap in autumn.
ZoneOffsetTransition
models the transition between the two offsets.
Gaps occur where there are local date-times that simply do not not exist.
An example would be when the offset changes from +03:00
to +04:00
.
This might be described as 'the clocks will move forward one hour tonight at 1am'.
Overlaps occur where there are local date-times that exist twice.
An example would be when the offset changes from +04:00
to +03:00
.
This might be described as 'the clocks will move back one hour tonight at 2am'.
This class is immutable and thread-safe.
Method Summary | |
---|---|
int |
compareTo(ZoneOffsetTransition transition)
Compares this transition to another based on the transition instant. |
boolean |
equals(java.lang.Object other)
Checks if this object equals another. |
OffsetDateTime |
getDateTimeAfter()
Gets the transition date-time expressed with the 'after' offset. |
OffsetDateTime |
getDateTimeBefore()
Gets the transition instant date-time expressed with the 'before' offset. |
Instant |
getInstant()
Gets the transition instant. |
LocalDateTime |
getLocal()
Gets the local date-time at the transition which is expressed relative to the 'before' offset. |
ZoneOffset |
getOffsetAfter()
Gets the offset after the transition. |
ZoneOffset |
getOffsetBefore()
Gets the offset before the transition. |
Period |
getTransitionSize()
Gets the length of the transition as a Period . |
int |
hashCode()
Returns a suitable hash code. |
boolean |
isGap()
Does this transition represent a gap in the local time-line. |
boolean |
isOverlap()
Does this transition represent a gap in the local time-line. |
boolean |
isValidOffset(ZoneOffset offset)
Checks if the specified offset is valid during this transition. |
static ZoneOffsetTransition |
of(OffsetDateTime transition,
ZoneOffset offsetAfter)
Obtains an instance defining a transition between two offsets. |
java.lang.String |
toString()
Returns a string describing this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static ZoneOffsetTransition of(OffsetDateTime transition, ZoneOffset offsetAfter)
Applications should normally obtain an instance from ZoneRules
.
This constructor is intended for use by implementors of ZoneRules
.
transition
- the transition date-time with the offset before the transition, not nulloffsetAfter
- the offset at and after the transition, not nullpublic Instant getInstant()
This is the instant of the discontinuity, which is defined as the first instant that the 'after' offset applies.
The methods getInstant()
, getDateTimeBefore()
and getDateTimeAfter()
all represent the same instant.
public LocalDateTime getLocal()
This is the date-time where the discontinuity begins.
For a gap, this local date-time never occurs, whereas for an overlap it occurs
just once after the entire transition is complete.
This method is simply getDateTimeBefore().toLocalDateTime()
This value expresses the date-time normally used in verbal communications. For example 'the clocks will move forward one hour tonight at 1am' (a gap) or 'the clocks will move back one hour tonight at 2am' (an overlap).
public OffsetDateTime getDateTimeBefore()
This is the date-time where the discontinuity begins expressed with the before offset. At this instant, the after offset is actually used, therefore this is an invalid date-time.
The methods getInstant()
, getDateTimeBefore()
and getDateTimeAfter()
all represent the same instant.
public OffsetDateTime getDateTimeAfter()
This is the first date-time after the discontinuity, when the new offset applies.
The methods getInstant()
, getDateTimeBefore()
and getDateTimeAfter()
all represent the same instant.
public ZoneOffset getOffsetBefore()
This is the offset in use before the instant of the transition.
public ZoneOffset getOffsetAfter()
This is the offset in use on and after the instant of the transition.
public Period getTransitionSize()
Period
.
This will typically be one hour, but might not be. It will be positive for a gap and negative for an overlap.
public boolean isGap()
Gaps occur where there are local date-times that simply do not not exist.
An example would be when the offset changes from +01:00
to +02:00
.
This might be described as 'the clocks will move forward one hour tonight at 1am'.
public boolean isOverlap()
Overlaps occur where there are local date-times that exist twice.
An example would be when the offset changes from +02:00
to +01:00
.
This might be described as 'the clocks will move back one hour tonight at 2am'.
public boolean isValidOffset(ZoneOffset offset)
This checks to see if the given offset will be valid at some point in the transition. A gap will always return false. An overlap will return true if the offset is either the before or after offset.
offset
- the offset to check, null returns false
public int compareTo(ZoneOffsetTransition transition)
This compares the instants of each transition. The offsets are ignored, making this order inconsistent with equals.
compareTo
in interface java.lang.Comparable<ZoneOffsetTransition>
transition
- the transition to compare to, not null
public boolean equals(java.lang.Object other)
The entire state of the object is compared.
equals
in class java.lang.Object
other
- the other object to compare to, null returns false
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |