com.ibm.icu.util.TimeZoneTransition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of icu4j Show documentation
Show all versions of icu4j Show documentation
International Component for Unicode for Java (ICU4J) is a mature, widely used Java library
providing Unicode and Globalization support
The newest version!
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2007-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.util;
/**
* TimeZoneTransition
is a class representing a time zone transition.
* An instance has a time of transition and rules for both before and
* after the transition.
*
* @stable ICU 3.8
*/
public class TimeZoneTransition {
private final TimeZoneRule from;
private final TimeZoneRule to;
private final long time;
/**
* Constructs a TimeZoneTransition
with the time and the rules before/after
* the transition.
*
* @param time The time of transition in milliseconds since the base time.
* @param from The time zone rule used before the transition.
* @param to The time zone rule used after the transition.
*
* @stable ICU 3.8
*/
public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {
this.time = time;
this.from = from;
this.to = to;
}
/**
* Returns the time of transition in milliseconds since the base time.
*
* @return The time of the transition in milliseconds since the base time.
*
* @stable ICU 3.8
*/
public long getTime() {
return time;
}
/**
* Returns the rule used after the transition.
*
* @return The time zone rule used after the transition.
*
* @stable ICU 3.8
*/
public TimeZoneRule getTo() {
return to;
}
/**
* Returns the rule used before the transition.
*
* @return The time zone rule used after the transition.
*
* @stable ICU 3.8
*/
public TimeZoneRule getFrom() {
return from;
}
/**
* Returns a String
representation of this TimeZoneTransition
object.
* This method is used for debugging purpose only. The string representation can be changed
* in future version of ICU without any notice.
*
* @stable ICU 3.8
*/
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("time=" + time);
buf.append(", from={" + from + "}");
buf.append(", to={" + to + "}");
return buf.toString();
}
}