public final class ZonalTransition extends Object implements Comparable<ZonalTransition>, Serializable
Represents the change of a shift of the local time relative to POSIX-time in any timezone.
This class contains informations about the global timestamp of the
transition and the shifts/offsets before and after the transitions.
A change of a zonal shift can either be caused by special historical
events and political actions (change of standard time) or by establishing
daylight saving-rules (change from winter time to summer time and
reverse - DST). Therefore the total shift getTotalOffset() is
always the sum of the parts getStandardOffset() and
getDaylightSavingOffset().
Shifts are described on the local timeline in seconds. Following relationship holds between local time and POSIX-time:
getTotalOffset() = [Local Wall Time] - [POSIX Time]
A zonal transition induces a gap on the local timeline if the new shift is greater than the old shift. And an overlap occurs if the new shift is smaller than the old shift. A local time is not defined within gaps and ambivalent in overlapping regions.
| Constructor and Description |
|---|
ZonalTransition(long posixTime,
int previousOffset,
int totalOffset,
int daylightSavingOffset)
Creates a new transition between two shifts.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ZonalTransition other)
Compares preferrably the timeline order based on the global
timestamps of transitions, otherwise the total shift and finally
the DST-shift.
|
boolean |
equals(Object obj)
Based on the whole state with global POSIX-timestamp and all
internal shifts.
|
int |
getDaylightSavingOffset()
Returns the DST-shift (daylight savings) after this transition that is
the shift induced by change to summer time.
|
long |
getPosixTime()
Returns the global timestamp of this transition from one shift to
another as POSIX-timestamp.
|
int |
getPreviousOffset()
Returns the total shift before this transition.
|
int |
getSize()
Gets the difference between new and old total shift as
measure for the size of this transition.
|
int |
getStandardOffset()
Returns the standard shift after this transition as difference
between total shift and DST-shift (daylight savings).
|
int |
getTotalOffset()
Returns the total shift after this transition.
|
int |
hashCode()
Based on the POSIX-timestamp of the transition.
|
boolean |
isDaylightSaving()
Queries if there is any daylight savings after this transition.
|
boolean |
isGap()
Queries if this transition represents a gap on the local timeline
where local timestamps are invalid.
|
boolean |
isOverlap()
Queries if this transition represents an overlap on the local
timeline where local timestamps are ambivalent.
|
String |
toString()
Supports debugging.
|
public ZonalTransition(long posixTime,
int previousOffset,
int totalOffset,
int daylightSavingOffset)
Creates a new transition between two shifts.
posixTime - POSIX time of transitionpreviousOffset - previous total shift in secondstotalOffset - new total shift in secondsdaylightSavingOffset - DST-shift in secondsIllegalArgumentException - if the DST-shift is negativeUnixTime.getPosixTime(),
ZonalOffset.getIntegralAmount()public long getPosixTime()
Returns the global timestamp of this transition from one shift to another as POSIX-timestamp.
TimeScale.POSIXpublic int getPreviousOffset()
Returns the total shift before this transition.
getTotalOffset(),
ZonalOffset.getIntegralAmount()public int getTotalOffset()
Returns the total shift after this transition.
getPreviousOffset(),
getStandardOffset(),
getDaylightSavingOffset(),
isDaylightSaving(),
ZonalOffset.getIntegralAmount()public int getStandardOffset()
Returns the standard shift after this transition as difference between total shift and DST-shift (daylight savings).
Negative standard shifts are related to timezones west for Greenwich, positive to timezones east for Greenwich. The addition of the standard shift to POSIX-time yields the standard local time corresponding to winter time.
getTotalOffset(),
getDaylightSavingOffset(),
isDaylightSaving()public int getDaylightSavingOffset()
Returns the DST-shift (daylight savings) after this transition that is the shift induced by change to summer time.
If the method isDaylightSaving() yields the value false
then this method will simply yield 0.
getTotalOffset(),
getStandardOffset(),
isDaylightSaving()public boolean isDaylightSaving()
Queries if there is any daylight savings after this transition.
getDaylightSavingOffset()public int getSize()
Gets the difference between new and old total shift as measure for the size of this transition.
public boolean isGap()
Queries if this transition represents a gap on the local timeline where local timestamps are invalid.
true if this transition represents a gap (by definition
the new total shift is bigger than the previous one)
else falsepublic boolean isOverlap()
Queries if this transition represents an overlap on the local timeline where local timestamps are ambivalent.
true if this transition represents an overlap (by
definition the new total shift is smaller than the previous
one) else falsepublic int compareTo(ZonalTransition other)
Compares preferrably the timeline order based on the global timestamps of transitions, otherwise the total shift and finally the DST-shift.
The natural order is consistent with equals().
compareTo in interface Comparable<ZonalTransition>public boolean equals(Object obj)
Based on the whole state with global POSIX-timestamp and all internal shifts.
public int hashCode()
Based on the POSIX-timestamp of the transition.
Copyright © 2014. All rights reserved.