Libraryless. Click here for Pure Java version (2275L/14K).
sclass MatchableRecords<A extends IFieldsToList> { new L<A> records; *() {} *(A... records) { addAll(this.records, records); } O fulfillVariable(IF1<Var, A> makeRecord) { new Var var; O result = null; A record = makeRecord.get(var); O[] a = record._fieldsToList(); bigLoop: for (A r : records) { if (r.getClass() != record.getClass()) continue; O[] b = r._fieldsToList(); if (b.length != a.length) fail("Bad argument length: " + record); for i over a: if (a[i] == var) { if (result != null && !eq(result, b[i])) continue bigLoop; result = b[i]; } else if (!eq(a[i], b[i])) continue bigLoop; ret result; } null; } }
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: | #1025430 |
| Snippet name: | MatchableRecords |
| Eternal ID of this version: | #1025430/3 |
| Text MD5: | b56a2f2c222f7655c00eaf6f8ac36f65 |
| Transpilation MD5: | 90282f56d9ee1531a2fce0628fe24ca7 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-28 23:49:20 |
| Source code size: | 799 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 445 / 868 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |