1 | sclass LinkedToken { |
2 | S t; |
3 | LinkedToken prev, next; |
4 | LinkedToken prevIdentical, nextIdentical; |
5 | |
6 | *() {} |
7 | *(S *t) {} |
8 | } |
9 | |
10 | sclass Tokenization { |
11 | LinkedToken first, last; |
12 | new Map<S, LinkedToken> firstByContent; |
13 | new Map<S, LinkedToken> lastByContent; |
14 | |
15 | bool contains(S t) { |
16 | ret firstByContent.get(t) != null; |
17 | } |
18 | |
19 | int countInstances(S t) { |
20 | int n = 0; |
21 | LinkedToken lt = firstByContent.get(t); |
22 | while (lt != null) { |
23 | ++n; |
24 | lt = lt.nextIdentical; |
25 | } |
26 | ret n; |
27 | } |
28 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016609 |
Snippet name: | LinkedToken + Tokenization |
Eternal ID of this version: | #1016609/1 |
Text MD5: | 63c077da96808860c7c2d69204aa24ba |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-25 14:44:56 |
Source code size: | 531 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 346 / 541 |
Referenced in: | [show references] |