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

32
LINES

< > BotCompany Repo | #1008566 // Analyze input [dev.]

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

Uses 3874K of libraries. Click here for Pure Java version (2698L/18K/72K).

!7

static JTextField tf;
static JTextArea textArea;
static ConcurrentEvaluator currentEval;

p-substance {
  showFrame(northAndCenter(tf = jtextfield(), textArea = jtextarea()));
  onEnter(tf, f update);
}

svoid update {
  if (currentEval != null) currentEval.cancelAndWait();
  final new ConcurrentEvaluator eval;
  currentEval = eval;
  eval.addAll(evaluators(getText(tf)));
  eval.onNewResult = r { updateResults(eval) };
  eval.start();
}

svoid updateResults(ConcurrentEvaluator eval) {
  setText(textArea, lines(allToString(notNullOnly(eval.results()))));
}

static int coresToUse() { ret max(1, numberOfCores()-1); }

static L evaluators(fS s) {
  ret ll(
    func() { "trimmed: " + trim(s) },
    func() { "without punctuation: " + dropPunctuation(s) },
  );
}

Author comment

Began life as a copy of #1008553

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: #1008566
Snippet name: Analyze input [dev.]
Eternal ID of this version: #1008566/4
Text MD5: 25aecf6cba24503e7b22c59b9cdbdc9b
Transpilation MD5: 1f6a70fcff429b917a703aa4839ee4f1
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-23 21:20:29
Source code size: 801 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 580
Version history: 3 change(s)
Referenced in: