sclass TokenIndexedList extends RandomAccessAbstractList<S> { new Map<S, Token> index; // first occurrence of token new L<Token> list; sclass Token { S s; Token prevSame, nextSame; } public S get(int i) { ret list.get(i).s; } public int size() { ret list.size(); } public void set(int i, S s) { Token t = list.get(i); if (eq(t.s, s)) ret; // remove from chain if (t.prevSame == null) index.put(t.s, t.nextSame); else t.prevSame.nextSame = t.nextSame; if (t.nextSame != null) t.nextSame.prevSame = t.nextSame; // change token, add to chain Token t2 = index.get(s); t.s = s; ... } }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025480 |
| Snippet name: | TokenIndexedList [dev.] |
| Eternal ID of this version: | #1025480/2 |
| Text MD5: | 16b2bd84bb8a5605873b443b6cfeb768 |
| Author: | stefan |
| Category: | javax / image analysis |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-30 14:43:46 |
| Source code size: | 708 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 431 / 450 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |