-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZoneRules.bal
More file actions
397 lines (344 loc) · 16.8 KB
/
Copy pathZoneRules.bal
File metadata and controls
397 lines (344 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
import ballerina/jballerina.java;
# Ballerina class mapping for the Java `java.time.zone.ZoneRules` class.
@java:Binding {'class: "java.time.zone.ZoneRules"}
public distinct class ZoneRules {
*java:JObject;
*Object;
# The `handle` field that stores the reference to the `java.time.zone.ZoneRules` object.
public handle jObj;
# The init function of the Ballerina class mapping the `java.time.zone.ZoneRules` Java class.
#
# + obj - The `handle` value containing the Java reference of the object.
public function init(handle obj) {
self.jObj = obj;
}
# Returns the string representation of these zone rules.
#
# + return - The `string` form of the Java object instance.
public function toString() returns string {
return java:toString(self.jObj) ?: "";
}
# Checks whether these rules are equal to another object.
#
# + other - The object to compare with, may be `()`
# + return - `true` if these rules are equal to the specified object
public function isEquals(Object other) returns boolean {
return java_time_zone_ZoneRules_equals(self.jObj, other.jObj);
}
# Gets the runtime class of this `ZoneRules` object.
#
# + return - The `Class` object representing the runtime class, not null
public function getClass() returns Class {
handle externalObj = java_time_zone_ZoneRules_getClass(self.jObj);
Class newObj = new (externalObj);
return newObj;
}
# Gets the amount of daylight savings in effect at the specified instant, typically one hour
# when DST is active and zero when it is not.
#
# + instant - The instant to find the daylight savings for, not null
# + return - The amount of daylight savings, not null
public function getDaylightSavings(Instant instant) returns Duration {
handle externalObj = java_time_zone_ZoneRules_getDaylightSavings(self.jObj, instant.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Gets the offset in effect at the specified instant, accounting for any historical or
# daylight-saving transitions.
#
# + instant - The instant to find the offset for, not null
# + return - The offset in effect at the given instant, not null
public function getOffset(Instant instant) returns ZoneOffset {
handle externalObj = java_time_zone_ZoneRules_getOffset(self.jObj, instant.jObj);
ZoneOffset newObj = new (externalObj);
return newObj;
}
# Gets a suitable offset for the specified local date-time. If the local date-time falls in a
# gap or overlap, this returns a best-effort single offset rather than the full set of
# possibilities — see `getValidOffsets` for the exhaustive result.
#
# + localDateTime - The local date-time to find the offset for, not null
# + return - The best available offset for the given local date-time, not null
public function getOffsetForLocalDateTime(LocalDateTime localDateTime) returns ZoneOffset {
handle externalObj = java_time_zone_ZoneRules_getOffset2(self.jObj, localDateTime.jObj);
ZoneOffset newObj = new (externalObj);
return newObj;
}
# Gets the standard offset in effect at the specified instant, ignoring any daylight-saving
# adjustment.
#
# + instant - The instant to find the standard offset for, not null
# + return - The standard offset, not null
public function getStandardOffset(Instant instant) returns ZoneOffset {
handle externalObj = java_time_zone_ZoneRules_getStandardOffset(self.jObj, instant.jObj);
ZoneOffset newObj = new (externalObj);
return newObj;
}
# Gets the offset transition details for the specified local date-time, if it falls within a
# gap or overlap caused by a change in offset.
#
# + localDateTime - The local date-time to check, not null
# + return - The transition details, or `()` if the local date-time is not in a gap or overlap
public function getTransition(LocalDateTime localDateTime) returns ZoneOffsetTransition {
handle externalObj = java_time_zone_ZoneRules_getTransition(self.jObj, localDateTime.jObj);
ZoneOffsetTransition newObj = new (externalObj);
return newObj;
}
# Gets the recurring last transition rules, used to calculate future transitions beyond the
# last explicitly recorded historical transition.
#
# + return - An immutable list of transition rules, not null
public function getTransitionRules() returns List {
handle externalObj = java_time_zone_ZoneRules_getTransitionRules(self.jObj);
List newObj = new (externalObj);
return newObj;
}
# Gets the complete list of historical offset transitions for this zone.
#
# + return - An immutable list of transitions, not null
public function getTransitions() returns List {
handle externalObj = java_time_zone_ZoneRules_getTransitions(self.jObj);
List newObj = new (externalObj);
return newObj;
}
# Gets the list of offsets valid for the specified local date-time. Normally returns a single
# offset; returns two offsets during a local time-line overlap (such as the autumn DST
# transition), or zero offsets during a gap (such as the spring-forward transition).
#
# + localDateTime - The local date-time to query, not null
# + return - The list of valid offsets, which may be empty, not null
public function getValidOffsets(LocalDateTime localDateTime) returns List {
handle externalObj = java_time_zone_ZoneRules_getValidOffsets(self.jObj, localDateTime.jObj);
List newObj = new (externalObj);
return newObj;
}
# Returns a hash code value for these zone rules.
#
# + return - A suitable hash code
public function hashCode() returns int {
return java_time_zone_ZoneRules_hashCode(self.jObj);
}
# Checks whether daylight savings is in effect at the specified instant.
#
# + instant - The instant to check, not null
# + return - `true` if daylight savings is in effect at the given instant
public function isDaylightSavings(Instant instant) returns boolean {
return java_time_zone_ZoneRules_isDaylightSavings(self.jObj, instant.jObj);
}
# Checks whether this set of rules has a fixed offset that never changes (no daylight
# savings, no historical transitions), such as for a plain `ZoneOffset`.
#
# + return - `true` if the offset never changes
public function isFixedOffset() returns boolean {
return java_time_zone_ZoneRules_isFixedOffset(self.jObj);
}
# Checks whether the specified offset is valid for the specified local date-time.
#
# + localDateTime - The local date-time to check, not null
# + offset - The offset to check, not null
# + return - `true` if the offset is one of the valid offsets for the given local date-time
public function isValidOffset(LocalDateTime localDateTime, ZoneOffset offset) returns boolean {
return java_time_zone_ZoneRules_isValidOffset(self.jObj, localDateTime.jObj, offset.jObj);
}
# Gets the next transition strictly after the specified instant.
#
# + instant - The instant to search from, not null
# + return - The next transition after the given instant, or `()` if this zone has a fixed offset
function nextTransition(Instant instant) returns ZoneOffsetTransition {
handle externalObj = java_time_zone_ZoneRules_nextTransition(self.jObj, instant.jObj);
ZoneOffsetTransition newObj = new (externalObj);
return newObj;
}
# Wakes up a single thread that is waiting on this object's monitor.
public function notify() {
java_time_zone_ZoneRules_notify(self.jObj);
}
# Wakes up all threads that are waiting on this object's monitor.
public function notifyAll() {
java_time_zone_ZoneRules_notifyAll(self.jObj);
}
# Gets the previous transition strictly before the specified instant.
#
# + instant - The instant to search from, not null
# + return - The previous transition before the given instant, or `()` if this zone has a fixed offset
function previousTransition(Instant instant) returns ZoneOffsetTransition {
handle externalObj = java_time_zone_ZoneRules_previousTransition(self.jObj, instant.jObj);
ZoneOffsetTransition newObj = new (externalObj);
return newObj;
}
# Causes the current thread to wait until it is woken up on this object's monitor, typically via
# a call to notify() or notifyAll().
#
# + return - An `InterruptedException` if the waiting thread is interrupted, otherwise `()`
public function doWait() returns InterruptedException? {
error|() externalObj = java_time_zone_ZoneRules_wait(self.jObj);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
# Causes the current thread to wait until either it is woken up or the specified timeout elapses.
#
# + timeoutMillis - The maximum time to wait, in milliseconds
# + return - An `InterruptedException` if the waiting thread is interrupted, otherwise `()`
public function waitWithTimeout(int timeoutMillis) returns InterruptedException? {
error|() externalObj = java_time_zone_ZoneRules_wait2(self.jObj, timeoutMillis);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
# Causes the current thread to wait until either it is woken up or the specified timeout elapses,
# with additional nanosecond precision.
#
# + timeoutMillis - The maximum time to wait, in milliseconds
# + additionalNanos - The additional time to wait, in nanoseconds, from 0 to 999999
# + return - An `InterruptedException` if the waiting thread is interrupted, otherwise `()`
public function waitWithTimeoutAndNanos(int timeoutMillis, int additionalNanos) returns InterruptedException? {
error|() externalObj = java_time_zone_ZoneRules_wait3(self.jObj, timeoutMillis, additionalNanos);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
}
# Obtains an instance of ZoneRules with a fixed offset that has no daylight-saving transitions.
#
# + offset - The offset to apply for the entire lifetime of these rules, not null
# + return - The zone rules, not null
public function zoneRulesOf(ZoneOffset offset) returns ZoneRules {
handle externalObj = java_time_zone_ZoneRules_of(offset.jObj);
ZoneRules newObj = new (externalObj);
return newObj;
}
# The function that maps to the `of` method of `java.time.zone.ZoneRules`.
# Low-level factory used internally by the JDK to construct ZoneRules from raw transition
# history and future transition rules; not intended for typical application use — most
# consumers should obtain a ZoneRules instance via `ZoneId.getRules()` or `ZoneOffset.getRules()`.
#
# + baseStandardOffset - The standard offset to use before any transitions, not null
# + baseWallOffset - The wall offset to use before any transitions, not null
# + standardOffsetTransitionList - The list of changes to the standard offset, not null
# + transitionList - The list of transitions, not null
# + lastRules - The recurring last rules, size 16 or less, not null
# + return - The zone rules, not null
function zoneRulesOf2(ZoneOffset baseStandardOffset, ZoneOffset baseWallOffset, List standardOffsetTransitionList, List transitionList, List lastRules) returns ZoneRules {
handle externalObj = java_time_zone_ZoneRules_of2(baseStandardOffset.jObj, baseWallOffset.jObj, standardOffsetTransitionList.jObj, transitionList.jObj, lastRules.jObj);
ZoneRules newObj = new (externalObj);
return newObj;
}
function java_time_zone_ZoneRules_equals(handle receiver, handle arg0) returns boolean = @java:Method {
name: "equals",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.lang.Object"]
} external;
function java_time_zone_ZoneRules_getClass(handle receiver) returns handle = @java:Method {
name: "getClass",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_getDaylightSavings(handle receiver, handle arg0) returns handle = @java:Method {
name: "getDaylightSavings",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_getOffset(handle receiver, handle arg0) returns handle = @java:Method {
name: "getOffset",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_getOffset2(handle receiver, handle arg0) returns handle = @java:Method {
name: "getOffset",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.LocalDateTime"]
} external;
function java_time_zone_ZoneRules_getStandardOffset(handle receiver, handle arg0) returns handle = @java:Method {
name: "getStandardOffset",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_getTransition(handle receiver, handle arg0) returns handle = @java:Method {
name: "getTransition",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.LocalDateTime"]
} external;
function java_time_zone_ZoneRules_getTransitionRules(handle receiver) returns handle = @java:Method {
name: "getTransitionRules",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_getTransitions(handle receiver) returns handle = @java:Method {
name: "getTransitions",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_getValidOffsets(handle receiver, handle arg0) returns handle = @java:Method {
name: "getValidOffsets",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.LocalDateTime"]
} external;
function java_time_zone_ZoneRules_hashCode(handle receiver) returns int = @java:Method {
name: "hashCode",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_isDaylightSavings(handle receiver, handle arg0) returns boolean = @java:Method {
name: "isDaylightSavings",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_isFixedOffset(handle receiver) returns boolean = @java:Method {
name: "isFixedOffset",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_isValidOffset(handle receiver, handle arg0, handle arg1) returns boolean = @java:Method {
name: "isValidOffset",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.LocalDateTime", "java.time.ZoneOffset"]
} external;
function java_time_zone_ZoneRules_nextTransition(handle receiver, handle arg0) returns handle = @java:Method {
name: "nextTransition",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_notify(handle receiver) = @java:Method {
name: "notify",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_notifyAll(handle receiver) = @java:Method {
name: "notifyAll",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_of(handle arg0) returns handle = @java:Method {
name: "of",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.ZoneOffset"]
} external;
function java_time_zone_ZoneRules_of2(handle arg0, handle arg1, handle arg2, handle arg3, handle arg4) returns handle = @java:Method {
name: "of",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.ZoneOffset", "java.time.ZoneOffset", "java.util.List", "java.util.List", "java.util.List"]
} external;
function java_time_zone_ZoneRules_previousTransition(handle receiver, handle arg0) returns handle = @java:Method {
name: "previousTransition",
'class: "java.time.zone.ZoneRules",
paramTypes: ["java.time.Instant"]
} external;
function java_time_zone_ZoneRules_wait(handle receiver) returns error? = @java:Method {
name: "wait",
'class: "java.time.zone.ZoneRules",
paramTypes: []
} external;
function java_time_zone_ZoneRules_wait2(handle receiver, int arg0) returns error? = @java:Method {
name: "wait",
'class: "java.time.zone.ZoneRules",
paramTypes: ["long"]
} external;
function java_time_zone_ZoneRules_wait3(handle receiver, int arg0, int arg1) returns error? = @java:Method {
name: "wait",
'class: "java.time.zone.ZoneRules",
paramTypes: ["long", "int"]
} external;