Libraryless. Click here for Pure Java version (5942L/35K).
static ThreadLocal<Bool> dataToTable_useStruct = threadLocalWithDefault(true); static void dataToTable_dynSet(L l, int i, O s) { while (i >= l.size()) l.add(""); l.set(i, s); } static L dataToTable_makeRow(O x, L<S> cols) { if (instanceOf(x, "DynamicObject")) x = get_raw(x, "fieldValues"); if (x instanceof Map) { Map m = cast x; new L row; for (O _field : keysWithoutHidden(m)) { S field = cast _field; O value = m.get(field); int col = cols.indexOf(field); if (col < 0) { cols.add(field); col = cols.size()-1; } dataToTable_dynSet(row, col, dataToTable_wrapValue(value)); } ret row; } // XXX new if (x cast L) ret allToString(x); ret litlist(structureOrText(x)); } static O dataToTable_wrapValue(O o) { if (o instanceof BufferedImage) ret o; if (o cast MakesBufferedImage) ret o.getBufferedImage(); ifclass RGBImage if (o instanceof RGBImage) ret o; // huh? endif if (o instanceof Bool) ret o; ret dataToTable_useStruct! ? structureOrTextForUser(o) : strOrNull(o); }
Began life as a copy of #1001613
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001984 |
Snippet name: | dataToTable_makeRow |
Eternal ID of this version: | #1001984/9 |
Text MD5: | 4c87fa222d8ed79780df7c658fed8db3 |
Transpilation MD5: | d588f69bfb6862cf30f4841d54062034 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-12 04:27:39 |
Source code size: | 1135 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 795 / 1433 |
Version history: | 8 change(s) |
Referenced in: | [show references] |