• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GENERATED SOURCE. DO NOT MODIFY. */
2 // © 2016 and later: Unicode, Inc. and others.
3 // License & terms of use: http://www.unicode.org/copyright.html#License
4 /*
5  *******************************************************************************
6  * Copyright (C) 2007-2010, International Business Machines Corporation and    *
7  * others. All Rights Reserved.                                                *
8  *******************************************************************************
9  */
10 package ohos.global.icu.util;
11 /**
12  * <code>TimeZoneTransition</code> is a class representing a time zone transition.
13  * An instance has a time of transition and rules for both before and
14  * after the transition.
15  *
16  * @hide exposed on OHOS
17  */
18 public class TimeZoneTransition {
19     private final TimeZoneRule from;
20     private final TimeZoneRule to;
21     private final long time;
22 
23     /**
24      * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after
25      * the transition.
26      *
27      * @param time  The time of transition in milliseconds since the base time.
28      * @param from  The time zone rule used before the transition.
29      * @param to    The time zone rule used after the transition.
30      */
TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to)31     public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {
32         this.time = time;
33         this.from = from;
34         this.to = to;
35     }
36 
37     /**
38      * Returns the time of transition in milliseconds since the base time.
39      *
40      * @return The time of the transition in milliseconds since the base time.
41      */
getTime()42     public long getTime() {
43         return time;
44     }
45 
46     /**
47      * Returns the rule used after the transition.
48      *
49      * @return The time zone rule used after the transition.
50      */
getTo()51     public TimeZoneRule getTo() {
52         return to;
53     }
54 
55     /**
56      * Returns the rule used before the transition.
57      *
58      * @return The time zone rule used after the transition.
59      */
getFrom()60     public TimeZoneRule getFrom() {
61         return from;
62     }
63 
64     /**
65      * Returns a <code>String</code> representation of this <code>TimeZoneTransition</code> object.
66      * This method is used for debugging purpose only.  The string representation can be changed
67      * in future version of ICU without any notice.
68      */
69     @Override
toString()70     public String toString() {
71         StringBuilder buf = new StringBuilder();
72         buf.append("time=" + time);
73         buf.append(", from={" + from + "}");
74         buf.append(", to={" + to + "}");
75         return buf.toString();
76     }
77 }
78