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

1  
!7
2  
3  
static JTextField tf;
4  
static JTextArea textArea;
5  
static ConcurrentEvaluator currentEval;
6  
7  
p-substance {
8  
  showFrame(northAndCenter(tf = jtextfield(), textArea = jtextarea()));
9  
  onEnter(tf, f update);
10  
}
11  
12  
svoid update {
13  
  if (currentEval != null) currentEval.cancelAndWait();
14  
  final new ConcurrentEvaluator eval;
15  
  currentEval = eval;
16  
  eval.addAll(evaluators(getText(tf)));
17  
  eval.onNewResult = r { updateResults(eval) };
18  
  eval.start();
19  
}
20  
21  
svoid updateResults(ConcurrentEvaluator eval) {
22  
  setText(textArea, lines(allToString(notNullOnly(eval.results()))));
23  
}
24  
25  
static int coresToUse() { ret max(1, numberOfCores()-1); }
26  
27  
static L evaluators(fS s) {
28  
  ret ll(
29  
    func() { "trimmed: " + trim(s) },
30  
    func() { "without punctuation: " + dropPunctuation(s) },
31  
  );
32  
}

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: 487 / 580
Version history: 3 change(s)
Referenced in: [show references]