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

34
LINES

< > BotCompany Repo | #1023980 // ai_parsePowerWordsText

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2654L/17K).

1  
static ParsedPowerWords ai_parsePowerWordsText(LS lines) {
2  
  new ParsedPowerWords out;
3  
  fOr (S s : lines)
4  
    ai_parsePowerWordsText_line(s, out);
5  
  ret out;
6  
}
7  
8  
static ParsedPowerWords ai_parsePowerWordsText(S text) {
9  
  new ParsedPowerWords out;
10  
  for (S s : tlftj(text))
11  
    ai_parsePowerWordsText_line(s, out);
12  
  ret out;
13  
}
14  
15  
svoid ai_parsePowerWordsText_line(S line, ParsedPowerWords out) {
16  
  LS tok = javaTok(line);
17  
  int i = jfind(tok, "<->");
18  
  if (i >= 0)
19  
    ret with out.equations.add(new ParsedPowerWords.Equation(
20  
      trimJoinSubList(tok, 0, i),
21  
      trimJoinSubList(tok, i+5), true));
22  
      
23  
  i = jfind(tok, "->");
24  
  if (i >= 0)
25  
    ret with out.equations.add(new ParsedPowerWords.Equation(
26  
      trimJoinSubList(tok, 0, i),
27  
      trimJoinSubList(tok, i+3), false));
28  
  
29  
  i = jfind(tok, "!=");
30  
  if (i >= 0)
31  
    ret with out.inequalities.add(pair(
32  
      trimJoinSubList(tok, 0, i),
33  
      trimJoinSubList(tok, i+3)));
34  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023980
Snippet name: ai_parsePowerWordsText
Eternal ID of this version: #1023980/8
Text MD5: 8f69e4b2c4df1a4a923da05582d99e94
Transpilation MD5: eb6c952c672ac3a6df781dd0e27843bb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-18 15:30:25
Source code size: 967 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 288 / 404
Version history: 7 change(s)
Referenced in: [show references]