1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.joda.time.tz;
17
18 import org.joda.time.DateTimeZone;
19
20
21
22
23
24
25
26
27
28 public final class FixedDateTimeZone extends DateTimeZone {
29
30 private static final long serialVersionUID = -3513011772763289092L;
31
32 private final String iNameKey;
33 private final int iWallOffset;
34 private final int iStandardOffset;
35
36 public FixedDateTimeZone(String id, String nameKey,
37 int wallOffset, int standardOffset) {
38 super(id);
39 iNameKey = nameKey;
40 iWallOffset = wallOffset;
41 iStandardOffset = standardOffset;
42 }
43
44 public String getNameKey(long instant) {
45 return iNameKey;
46 }
47
48 public int getOffset(long instant) {
49 return iWallOffset;
50 }
51
52 public int getStandardOffset(long instant) {
53 return iStandardOffset;
54 }
55
56 public int getOffsetFromLocal(long instantLocal) {
57 return iWallOffset;
58 }
59
60 public boolean isFixed() {
61 return true;
62 }
63
64 public long nextTransition(long instant) {
65 return instant;
66 }
67
68 public long previousTransition(long instant) {
69 return instant;
70 }
71
72
73
74
75
76 public java.util.TimeZone toTimeZone() {
77 String id = getID();
78 if (id.length() == 6 && (id.startsWith("+") || id.startsWith("-"))) {
79
80
81 return java.util.TimeZone.getTimeZone("GMT" + getID());
82 }
83
84 return new java.util.SimpleTimeZone(iWallOffset, getID());
85 }
86
87 public boolean equals(Object obj) {
88 if (this == obj) {
89 return true;
90 }
91 if (obj instanceof FixedDateTimeZone) {
92 FixedDateTimeZone other = (FixedDateTimeZone) obj;
93 return
94 getID().equals(other.getID()) &&
95 iStandardOffset == other.iStandardOffset &&
96 iWallOffset == other.iWallOffset;
97 }
98 return false;
99 }
100
101 public int hashCode() {
102 return getID().hashCode() + 37 * iStandardOffset + 31 * iWallOffset;
103 }
104
105 }