]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/util/TimeZoneTransition.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / main / classes / core / src / com / ibm / icu / util / TimeZoneTransition.java
1 /*
2  *******************************************************************************
3  * Copyright (C) 2007-2010, International Business Machines Corporation and    *
4  * others. All Rights Reserved.                                                *
5  *******************************************************************************
6  */
7 package com.ibm.icu.util;
8 /**
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.
12  * 
13  * @stable ICU 3.8
14  */
15 public class TimeZoneTransition {
16     private final TimeZoneRule from;
17     private final TimeZoneRule to;
18     private final long time;
19
20     /**
21      * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after
22      * the transition.
23      * 
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.
27      * 
28      * @stable ICU 3.8
29      */
30     public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {
31         this.time = time;
32         this.from = from;
33         this.to = to;
34     }
35
36     /**
37      * Returns the time of transition in milliseconds since the base time.
38      * 
39      * @return The time of the transition in milliseconds since the base time.
40      * 
41      * @stable ICU 3.8
42      */
43     public long getTime() {
44         return time;
45     }
46
47     /**
48      * Returns the rule used after the transition.
49      * 
50      * @return The time zone rule used after the transition.
51      * 
52      * @stable ICU 3.8
53      */
54     public TimeZoneRule getTo() {
55         return to;
56     }
57
58     /**
59      * Returns the rule used before the transition.
60      * 
61      * @return The time zone rule used after the transition.
62      * 
63      * @stable ICU 3.8
64      */
65     public TimeZoneRule getFrom() {
66         return from;
67     }
68
69     /**
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.
73      * 
74      * @stable ICU 3.8
75      */
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();
82     }
83 }