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).

!7

sS listName = "heise.de 2018/04/20 (raw)";
static L<S> data;
static JList list;
static Q opThread = startQ();

p-subst {
  autoRestart();
  L<S> lines = trimAll(lines(mechList_raw(listName)));
  data = notEndingWith(".", filter containsSpace(standAloneLines(lines));
  makeList();
  
  L<S> ops = mechLists_intersect("Operations on lists", "Safe JavaX functions");
  
  new L<JComponent> buttons;
  buttons.add(jbutton("Drop analyzed", r { opThread.add(f dropAnalyzed) }));
  buttons.add(selectedRowCountListButton_min(list, 2, jbutton("Mark similar", r { opThread.add(f markSimilar) })));
  buttons.addAll(map(ops, func(fS op) -> JButton {
    jbutton(op, r { opThread.add(r { performOp(op) }) })
  }));
  addToWindowWithMargin(list, jcenteredLine(buttons));
}

svoid performOp(S op) {
  O newData = callAndMake(op, data);
  if (isStringList(newData))
    data = (L<S>) newData;
  else
    data = lines(str(newData));
  makeList();
}

svoid makeList {
  list = showList(list, data);
  titleStatus_trailing(list, n2(l(data), "entry", "entries"));
}

svoid markSimilar {
  L<S> items = selectedListItems(list);
  S x = "Similar lines";
  x = barCombine(listName, x);
  int i = 1;
  Set<S> set = asCISet(items);
  while licensed {
    S name = appendNumberUnlessOne(x, i++);
    Set<S> s = mechCISet(name);
    if (eq(s, set))
      ret with infoBox("List already saved");
    if (empty(s)) {
      botEditMechList(name, items);
      ret with infoBox("Saved as " + name);
    }
  }
}

svoid dropAnalyzed {
  for (S list : mechListsPlusNumber(barCombine(listName, "Similar lines")))
    removeSetFromList(data, mechList(list));
  makeList();
}

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: 527 / 5185
Version history: 22 change(s)
Referenced in: