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

21
LINES

< > BotCompany Repo | #1017585 // StringMatcher

JavaX fragment (include)

abstract sclass StringMatcher {
  // change matches only if returning true
  abstract bool match(S pat, S input, SS matches);
  
  // seems to be the same in all subclasses
  S apply(S input, SS matches) {
    ret ai_standardReplaceVars(input, matches);
  }
  
  bool matchAnyPattern(Collection<S> patterns, S input, SS matches) {
    for (S pat : unnull(patterns))
      if (match(pat, input, matches)) true;
    false;
  }
  
  bool matchAnyInput(S pat, Collection<S> inputs, SS matches) {
    for (S input : unnull(inputs))
      if (match(pat, input, matches)) true;
    false;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017585
Snippet name: StringMatcher
Eternal ID of this version: #1017585/7
Text MD5: d097e9447deba23c333b0acc564cc710
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 15:24:18
Source code size: 607 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 298 / 864
Version history: 6 change(s)
Referenced in: [show references]