Libraryless. Click here for Pure Java version (9999L/55K).
1 | srecord TimestampRange(Timestamp start, Timestamp end) is Comparable<TimestampRange> {
|
2 | *(long start, long end) {
|
3 | this(Timestamp(start), Timestamp(end)); |
4 | } |
5 | |
6 | Timestamp start aka startTime() { ret start; }
|
7 | Timestamp end aka endTime() { ret end; }
|
8 | |
9 | selfType start aka startTime(Timestamp start) { this.start = start; this; }
|
10 | selfType end aka endTime(Timestamp end) { this.end = end; this; }
|
11 | |
12 | bool complete() { ret start != null && end != null; }
|
13 | |
14 | Duration duration() { ret !complete() ? null : end.minusAsDuration(start); }
|
15 | |
16 | long length() { ret !complete() ? 0 : end.unixDate()-start.unixDate(); }
|
17 | |
18 | toString { ret start + " to " + end; }
|
19 | |
20 | public int compareTo(TimestampRange r) {
|
21 | ret cmp(start, r.start); |
22 | } |
23 | |
24 | L<Timestamp> toList() { ret ll(start, end); }
|
25 | } |
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031686 |
| Snippet name: | TimestampRange |
| Eternal ID of this version: | #1031686/13 |
| Text MD5: | 28b9b53be3f844d2102b6fc0ec9556b4 |
| Transpilation MD5: | b4ed499c379da215e2224337c7161c93 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-12-20 22:20:26 |
| Source code size: | 825 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 583 / 1022 |
| Version history: | 12 change(s) |
| Referenced in: | [show references] |