2 *******************************************************************************
3 * Copyright (C) 2007-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.util;
9 * <code>TimeZoneTransition</code> is a class representing a time zone transition.
10 * An instance has a time of transition and rules for both before and
11 * after the transition.
15 public class TimeZoneTransition {
16 private final TimeZoneRule from;
17 private final TimeZoneRule to;
18 private final long time;
21 * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after
24 * @param time The time of transition in milliseconds since the base time.
25 * @param from The time zone rule used before the transition.
26 * @param to The time zone rule used after the transition.
30 public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {
37 * Returns the time of transition in milliseconds since the base time.
39 * @return The time of the transition in milliseconds since the base time.
43 public long getTime() {
48 * Returns the rule used after the transition.
50 * @return The time zone rule used after the transition.
54 public TimeZoneRule getTo() {
59 * Returns the rule used before the transition.
61 * @return The time zone rule used after the transition.
65 public TimeZoneRule getFrom() {
70 * Returns a <code>String</code> representation of this <code>TimeZoneTransition</code> object.
71 * This method is used for debugging purpose only. The string representation can be changed
72 * in future version of ICU without any notice.
76 public String toString() {
77 StringBuilder buf = new StringBuilder();
78 buf.append("time=" + time);
79 buf.append(", from={" + from + "}");
80 buf.append(", to={" + to + "}");
81 return buf.toString();