Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

61
LINES

< > BotCompany Repo | #1014358 // Analyze heise.de, show operations

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (9517L/67K).

1  
!7
2  
3  
sS listName = "heise.de 2018/04/20 (raw)";
4  
static L<S> data;
5  
static JList list;
6  
static Q opThread = startQ();
7  
8  
p-subst {
9  
  autoRestart();
10  
  L<S> lines = trimAll(lines(mechList_raw(listName)));
11  
  data = notEndingWith(".", filter containsSpace(standAloneLines(lines));
12  
  makeList();
13  
  
14  
  L<S> ops = mechLists_intersect("Operations on lists", "Safe JavaX functions");
15  
  
16  
  new L<JComponent> buttons;
17  
  buttons.add(jbutton("Drop analyzed", r { opThread.add(f dropAnalyzed) }));
18  
  buttons.add(selectedRowCountListButton_min(list, 2, jbutton("Mark similar", r { opThread.add(f markSimilar) })));
19  
  buttons.addAll(map(ops, func(fS op) -> JButton {
20  
    jbutton(op, r { opThread.add(r { performOp(op) }) })
21  
  }));
22  
  addToWindowWithMargin(list, jcenteredLine(buttons));
23  
}
24  
25  
svoid performOp(S op) {
26  
  O newData = callAndMake(op, data);
27  
  if (isStringList(newData))
28  
    data = (L<S>) newData;
29  
  else
30  
    data = lines(str(newData));
31  
  makeList();
32  
}
33  
34  
svoid makeList {
35  
  list = showList(list, data);
36  
  titleStatus_trailing(list, n2(l(data), "entry", "entries"));
37  
}
38  
39  
svoid markSimilar {
40  
  L<S> items = selectedListItems(list);
41  
  S x = "Similar lines";
42  
  x = barCombine(listName, x);
43  
  int i = 1;
44  
  Set<S> set = asCISet(items);
45  
  while licensed {
46  
    S name = appendNumberUnlessOne(x, i++);
47  
    Set<S> s = mechCISet(name);
48  
    if (eq(s, set))
49  
      ret with infoBox("List already saved");
50  
    if (empty(s)) {
51  
      botEditMechList(name, items);
52  
      ret with infoBox("Saved as " + name);
53  
    }
54  
  }
55  
}
56  
57  
svoid dropAnalyzed {
58  
  for (S list : mechListsPlusNumber(barCombine(listName, "Similar lines")))
59  
    removeSetFromList(data, mechList(list));
60  
  makeList();
61  
}

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: #1014358
Snippet name: Analyze heise.de, show operations
Eternal ID of this version: #1014358/23
Text MD5: 539d0d741947b29122b0352b3f371269
Transpilation MD5: 4704bbdd86de564c24ef7f5b2949d560
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-21 01:45:31
Source code size: 1705 bytes / 61 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 4859
Version history: 22 change(s)
Referenced in: [show references]