Download Jar. Libraryless. Click here for Pure Java version (9733L/70K).
!7 static S query; static L<SS> result; static volatile bool calculating; static NotTooOften notTooOften = onlyEvery10Secs(); static WaitForStableValue<S> waitForStableValue = new(5.0); static Q q; static int maxInputLength = 120; static transient JTable table; static transient ReliableSingleThread rst; static JComponent visualize() { ret dataToTable_uneditable(result, table = sexyTable()); } static void unvisualize2() { table = null; } p { q = startQ(); doEvery(1000, r update); } svoid update { lock programLock(); S s = (S) callOpt(creator(), 'getInterestingString); if (nempty(s) && l(s) <= maxInputLength) { // TODO: more quality checks? waitForStableValue.set(s); } fS q = waitForStableValue!; if (nempty(q) && neq(q, query) && allowedToGoogleSomething()) main.q.add(r { calc(q) }); } static void calc(S q) { if (eq(query, q)) ret; query = q; result = null; calculating = true; try { L<T3<S>> l = quickGoogle2(q); result = map(l, func(T3<S> t) -> SS { litorderedmap("Result" := second(t), "Desc" := third(t), "Link" := first(t)) }); JTable t = table; if (t != null) dataToTable_uneditable(result, t); } finally { calculating = false; } } sbool allowedToGoogleSomething() { ret notTooOften.canDoAgain_willDoIfTrue(); }
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: | #1015833 |
Snippet name: | Google (Dyn Module, v1, old) |
Eternal ID of this version: | #1015833/27 |
Text MD5: | 7895c86f200e13e50f4eaadd906852ab |
Transpilation MD5: | cef0ba1542d65e3dbfd308472dcc63e5 |
Author: | stefan |
Category: | |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-01 00:10:58 |
Source code size: | 1367 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 482 / 1385 |
Version history: | 26 change(s) |
Referenced in: | [show references] |