]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/classes/core/src/com/ibm/icu/util/TimeZoneTransition.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / classes / core / src / com / ibm / icu / util / TimeZoneTransition.java
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2007-2010, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.util;\r
8 /**\r
9  * <code>TimeZoneTransition</code> is a class representing a time zone transition.\r
10  * An instance has a time of transition and rules for both before and\r
11  * after the transition.\r
12  * \r
13  * @stable ICU 3.8\r
14  */\r
15 public class TimeZoneTransition {\r
16     private final TimeZoneRule from;\r
17     private final TimeZoneRule to;\r
18     private final long time;\r
19 \r
20     /**\r
21      * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after\r
22      * the transition.\r
23      * \r
24      * @param time  The time of transition in milliseconds since the base time.\r
25      * @param from  The time zone rule used before the transition.\r
26      * @param to    The time zone rule used after the transition.\r
27      * \r
28      * @stable ICU 3.8\r
29      */\r
30     public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {\r
31         this.time = time;\r
32         this.from = from;\r
33         this.to = to;\r
34     }\r
35 \r
36     /**\r
37      * Returns the time of transition in milliseconds since the base time.\r
38      * \r
39      * @return The time of the transition in milliseconds since the base time.\r
40      * \r
41      * @stable ICU 3.8\r
42      */\r
43     public long getTime() {\r
44         return time;\r
45     }\r
46 \r
47     /**\r
48      * Returns the rule used after the transition.\r
49      * \r
50      * @return The time zone rule used after the transition.\r
51      * \r
52      * @stable ICU 3.8\r
53      */\r
54     public TimeZoneRule getTo() {\r
55         return to;\r
56     }\r
57 \r
58     /**\r
59      * Returns the rule used before the transition.\r
60      * \r
61      * @return The time zone rule used after the transition.\r
62      * \r
63      * @stable ICU 3.8\r
64      */\r
65     public TimeZoneRule getFrom() {\r
66         return from;\r
67     }\r
68 \r
69     /**\r
70      * Returns a <code>String</code> representation of this <code>TimeZoneTransition</code> object.\r
71      * This method is used for debugging purpose only.  The string representation can be changed\r
72      * in future version of ICU without any notice.\r
73      * \r
74      * @stable ICU 3.8\r
75      */\r
76     public String toString() {\r
77         StringBuilder buf = new StringBuilder();\r
78         buf.append("time=" + time);\r
79         buf.append(", from={" + from + "}");\r
80         buf.append(", to={" + to + "}");\r
81         return buf.toString();\r
82     }\r
83 }\r