static long objectID(O o) { if (o == null) ret 0; Map generalMap = vm_generalMap(); if (generalMap == null) fail("Please upgrade JavaX"); synchronized(generalMap) { Map map = cast generalMap.get("objectIDs"); if (map == null) { pcall-short { map = (Map) nuForeignObject(javax(), className(javax()) + '$WeakIdentityHashMap); } if (map == null) map = new WeakIdentityHashMap; // older JavaX generalMap.put("objectIDs", map); } Long l = cast map.get(o); if (l == null) { l = toLong(generalMap.get("lastObjectID"))+1; generalMap.put("lastObjectID", l); map.put(o, l); } ret l; } } static Collection<Long> objectID_liveIDs() { Map generalMap = cast getOpt(javax(), 'generalMap); if (generalMap == null) ret new L; synchronized(generalMap) { ret cloneList(values((Map<O, Long>) generalMap.get("objectIDs"))); } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010611 |
Snippet name: | objectID - assign a unique long value to each queried object |
Eternal ID of this version: | #1010611/13 |
Text MD5: | 64f68f431764fd8ac9bc11cd26860dd8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-23 05:20:10 |
Source code size: | 936 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 499 / 551 |
Version history: | 12 change(s) |
Referenced in: | [show references] |