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

20
LINES

< > BotCompany Repo | #1021779 // dm_gazelle_matchAdditionalInput2 (OLD)

JavaX fragment (include)

svoid dm_gazelle_matchAdditionalInput2(L<GazelleTree> l, LS preContext, O... _) {
  for (GazelleTree t : l)
    if (t.rule() != null) {
      RuleEngine2_MatchedRule mr = t.mr;
      L<TextAndType> insWithType = t.rule().insWithType;
      int iCond = t.mr.iCond;
      TextAndType next = get(insWithType, iCond);
      if (next != null && startsWith(next.type, "history-")) {
        int historyIdx = parseFirstInt(next.type);
        S line = get(preContext, l(preContext)-historyIdx);
        if (line == null) continue with print("Got no line for: " + next.type);
        SS inputMap = litmap(next.type, line);
        if (ai_ruleEngine2_matchStep(t.mr, inputMap, true, _)) {
          print("Input match OK: " + line + " - new map: " + t.mr.map + ". Updating prediction.");
          gazelle_addPredictionToTreeNode(t);
        } else
          print("Input match failed: " + line);
      }
    }
}

Author comment

Began life as a copy of #1021775

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021779
Snippet name: dm_gazelle_matchAdditionalInput2 (OLD)
Eternal ID of this version: #1021779/9
Text MD5: 2efcf52ead585739e4b787d4399dd018
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 14:00:23
Source code size: 922 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 303 / 341
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1022069 - dm_gazelle_matchAdditionalInput3