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

static ParsedPowerWords ai_parsePowerWordsText(LS lines) {
  new ParsedPowerWords out;
  fOr (S s : lines)
    ai_parsePowerWordsText_line(s, out);
  ret out;
}

static ParsedPowerWords ai_parsePowerWordsText(S text) {
  new ParsedPowerWords out;
  for (S s : tlftj(text))
    ai_parsePowerWordsText_line(s, out);
  ret out;
}

svoid ai_parsePowerWordsText_line(S line, ParsedPowerWords out) {
  LS tok = javaTok(line);
  int i = jfind(tok, "<->");
  if (i >= 0)
    ret with out.equations.add(new ParsedPowerWords.Equation(
      trimJoinSubList(tok, 0, i),
      trimJoinSubList(tok, i+5), true));
      
  i = jfind(tok, "->");
  if (i >= 0)
    ret with out.equations.add(new ParsedPowerWords.Equation(
      trimJoinSubList(tok, 0, i),
      trimJoinSubList(tok, i+3), false));
  
  i = jfind(tok, "!=");
  if (i >= 0)
    ret with out.inequalities.add(pair(
      trimJoinSubList(tok, 0, i),
      trimJoinSubList(tok, i+3)));
}

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