Libraryless. Click here for Pure Java version (2256L/14K).
1 | sclass Ext<A> extends DynamicObject implements IVar<A> {
|
2 | *() {}
|
3 | *(A *v) {}
|
4 | //O equalityPredicate; // func(Ext, Ext) -> bool |
5 | |
6 | bool fullToString; // include values in toString |
7 | |
8 | A v; // you can access this directly if you use one thread |
9 | |
10 | public synchronized void set(A a) {
|
11 | if (v != a) {
|
12 | v = a; |
13 | notifyAll(); |
14 | } |
15 | } |
16 | |
17 | public synchronized A get() { ret v; }
|
18 | public synchronized bool has() { ret v != null; }
|
19 | public synchronized void clear() { v = null; }
|
20 | |
21 | public bool equals(O o) {
|
22 | ret o instanceof Ext && eq(o/Ext.v, v); |
23 | } |
24 | |
25 | public int hashCode() { ret _hashCode(v); }
|
26 | |
27 | toString {
|
28 | ret !fullToString ? str(get()) : extToString(this); |
29 | } |
30 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1023197 |
| Snippet name: | Ext (extended variable with additional fields) |
| Eternal ID of this version: | #1023197/12 |
| Text MD5: | e9582aa3a586b91570a3e7bf8117c6f6 |
| Transpilation MD5: | 81e7720b91dd8543eb47cb91710982ab |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-12 21:59:23 |
| Source code size: | 726 bytes / 30 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 618 / 1161 |
| Version history: | 11 change(s) |
| Referenced in: | [show references] |