Libraryless. Click here for Pure Java version (5072L/28K).
1 | enum NESWDirection {
|
2 | north(0, -1), |
3 | east(1, 0), |
4 | south(0, 1), |
5 | west(-1, 0); |
6 | |
7 | // cache values() |
8 | static final selfType values[] = values(); |
9 | |
10 | private final gettable int x; |
11 | private final gettable int y; |
12 | |
13 | *(int *x, int *y) {}
|
14 | |
15 | int index() { ret ordinal(); }
|
16 | |
17 | NESWDirection plus(int i) {
|
18 | ret getNESWDirection(index()+i); |
19 | } |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034905 |
| Snippet name: | NESWDirection |
| Eternal ID of this version: | #1034905/4 |
| Text MD5: | ee7444e8f093c6020d7fe106e012a989 |
| Transpilation MD5: | 8fb0da31750bc1fedc94dae4dc5db3fd |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-14 17:59:00 |
| Source code size: | 372 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 585 / 735 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |