src/share/classes/java/time/zone/ZoneOffsetTransition.java

Print this page




 304      * @return the duration in seconds
 305      */
 306     private int getDurationSeconds() {
 307         return getOffsetAfter().getTotalSeconds() - getOffsetBefore().getTotalSeconds();
 308     }
 309 
 310     /**
 311      * Does this transition represent a gap in the local time-line.
 312      * <p>
 313      * Gaps occur where there are local date-times that simply do not not exist.
 314      * An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
 315      * This might be described as 'the clocks will move forward one hour tonight at 1am'.
 316      *
 317      * @return true if this transition is a gap, false if it is an overlap
 318      */
 319     public boolean isGap() {
 320         return getOffsetAfter().getTotalSeconds() > getOffsetBefore().getTotalSeconds();
 321     }
 322 
 323     /**
 324      * Does this transition represent a gap in the local time-line.
 325      * <p>
 326      * Overlaps occur where there are local date-times that exist twice.
 327      * An example would be when the offset changes from {@code +02:00} to {@code +01:00}.
 328      * This might be described as 'the clocks will move back one hour tonight at 2am'.
 329      *
 330      * @return true if this transition is an overlap, false if it is a gap
 331      */
 332     public boolean isOverlap() {
 333         return getOffsetAfter().getTotalSeconds() < getOffsetBefore().getTotalSeconds();
 334     }
 335 
 336     /**
 337      * Checks if the specified offset is valid during this transition.
 338      * <p>
 339      * This checks to see if the given offset will be valid at some point in the transition.
 340      * A gap will always return false.
 341      * An overlap will return true if the offset is either the before or after offset.
 342      *
 343      * @param offset  the offset to check, null returns false
 344      * @return true if the offset is valid during the transition




 304      * @return the duration in seconds
 305      */
 306     private int getDurationSeconds() {
 307         return getOffsetAfter().getTotalSeconds() - getOffsetBefore().getTotalSeconds();
 308     }
 309 
 310     /**
 311      * Does this transition represent a gap in the local time-line.
 312      * <p>
 313      * Gaps occur where there are local date-times that simply do not not exist.
 314      * An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
 315      * This might be described as 'the clocks will move forward one hour tonight at 1am'.
 316      *
 317      * @return true if this transition is a gap, false if it is an overlap
 318      */
 319     public boolean isGap() {
 320         return getOffsetAfter().getTotalSeconds() > getOffsetBefore().getTotalSeconds();
 321     }
 322 
 323     /**
 324      * Does this transition represent an overlap in the local time-line.
 325      * <p>
 326      * Overlaps occur where there are local date-times that exist twice.
 327      * An example would be when the offset changes from {@code +02:00} to {@code +01:00}.
 328      * This might be described as 'the clocks will move back one hour tonight at 2am'.
 329      *
 330      * @return true if this transition is an overlap, false if it is a gap
 331      */
 332     public boolean isOverlap() {
 333         return getOffsetAfter().getTotalSeconds() < getOffsetBefore().getTotalSeconds();
 334     }
 335 
 336     /**
 337      * Checks if the specified offset is valid during this transition.
 338      * <p>
 339      * This checks to see if the given offset will be valid at some point in the transition.
 340      * A gap will always return false.
 341      * An overlap will return true if the offset is either the before or after offset.
 342      *
 343      * @param offset  the offset to check, null returns false
 344      * @return true if the offset is valid during the transition