Libraryless. Click here for Pure Java version (9985L/56K).
1 | sclass VarWithNotify<A> extends Var<A> is IVarWithNotify<A> { |
2 | event fireChange; |
3 | |
4 | *() {} |
5 | *(A a) { super(a); } |
6 | |
7 | // clever way (I hope) to do eq() outside of synchronization block |
8 | public void set(A a) { |
9 | A v = get(); |
10 | if (eq(v, a)) { |
11 | print ifdef VarWithNotify_debug("VarWithNotify.set no change " + a); |
12 | ret; |
13 | } |
14 | |
15 | print ifdef VarWithNotify_debug("VarWithNotify.set change " + a); |
16 | synchronized { |
17 | this.v = a; |
18 | notifyAll(); |
19 | } |
20 | fireChange(); |
21 | } |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034091 |
Snippet name: | VarWithNotify |
Eternal ID of this version: | #1034091/12 |
Text MD5: | 046988ea1a2e2c74040126ff9f7256c3 |
Transpilation MD5: | c210b900b873e3f8050719020cd74b16 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-08 09:21:00 |
Source code size: | 524 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 204 / 343 |
Version history: | 11 change(s) |
Referenced in: | [show references] |