Uses 3874K of libraries. Click here for Pure Java version (8312L/57K/198K).
!752 // set these in client static S dbName = "Boolean Flag DB."; static L<S> interpretations = splitAtSpace("ShowWindow HideWindow IsShowing Praise Hello NotForMe Unclear"); static RemoteDB db; static L<RC> lines; static JTable table; p-substance { fullRefresh(); L<Component> interpretButtons = map(func(final S cname) { jbutton(cname, r { interpret(cname) }) }, interpretations); interpretButtons.add(0, jbutton("Delete", "delete")); tableDependButtons(table, interpretButtons); addToWindow(table, jMinHeight(50, new JScrollPane(jCenteredLine( concatLists( ll((Component) jbutton("Refresh", "fullRefresh")), interpretButtons))))); } svoid fullRefresh { if (db != null) db.close(); db = new RemoteDB(dbName); //db.db.loud = true; refresh(); } svoid refresh { lines = db.xlist("Line"); table = showTable(table, sortedByFieldIgnoreCase("Input", map(func(RC line) { RC intp = db.xgetref(line, "interpretation"); RC guess = db.xgetref(line, "guess"); RC guessedAs = guess == null ? null : db.xgetref(guess, "guessedAs"); ret litorderedmap("Input", db.xS(line, "text"), "Interpretation", intp == null ? "uninterpreted" : db.xclass(intp), "Guess", guessedAs == null ? "" : db.xS(guessedAs, "text")); }, lines))); } static void interpret(S cname) { L line = getSelectedLine(table); if (line == null) ret; S text = (S) line.get(0); print("Interpreting " + quote(text) + " as " + cname); RC ref = (RC) rpc(db.db, "xfindLine", text); RC intp = db.uniq(cname); db.xset(ref, "interpretation", intp); print("Done!"); refresh(); } svoid delete { L line = getSelectedLine(table); if (line == null) ret; S text = (S) line.get(0); print("Deleting line " + quote(text)); RC ref = (RC) rpc(db.db, "xfindLine", text); db.xdelete(ref); print("Done!"); refresh(); }
Began life as a copy of #1004926
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: | #1007333 |
Snippet name: | Refactored Admin For Text AI |
Eternal ID of this version: | #1007333/1 |
Text MD5: | e32604c91b224829e6290a7f707f3b8f |
Transpilation MD5: | d1b3e70dcb7868e52d4e0c690c1c957c |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-15 14:44:07 |
Source code size: | 1932 bytes / 65 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 553 / 863 |
Referenced in: | #1004973 - Fixing Admin - Refactored New AI [Show / Hide Window / Learns Any Language!] |