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

24
LINES

< > BotCompany Repo | #1021775 // dm_gazelle_matchAdditionalInput (OLD, use v2)

JavaX fragment (include)

svoid dm_gazelle_matchAdditionalInput(L<GazelleTree> l, LS inputs, O... _) {
  for (GazelleTree t : l)
    if (t.rule() != null) {
      RuleEngine2_MatchedRule mr = t.mr;
      LS in = t.rule().in;
      int iCond = t.mr.iCond;
      if (l(in) > iCond) {
        LS conditions = dropFirst(iCond, in);
        print("Remaining conditions for " + t.ruleID() + " with " + t.mr.map + ": " + conditions);
        new Matches m;
        if (matchAny("in " + (iCond+1) + " = *", t.rule().comments, m) && neq($1, 'input))
          continue with print("Not an input condition");
          
        S input = get(inputs, iCond);
        if (input == null)
          continue with print("No more input (iCond=" + iCond + ", inputs=" + inputs + ")");
          
        if (ai_ruleEngine2_matchStep(t.mr, litmap(standard := input), true))
          print("Input match OK: " + input + " - new map: " + t.mr.map);
        else
          print("Input match failed: " + input);
      }
    }
}

Author comment

Began life as a copy of #1021772

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: #1021775
Snippet name: dm_gazelle_matchAdditionalInput (OLD, use v2)
Eternal ID of this version: #1021775/6
Text MD5: 26ef41ca3a16d0e804b6a6e42e976030
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-05 16:41:42
Source code size: 1002 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 309 / 335
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1021779 - dm_gazelle_matchAdditionalInput2 (OLD)