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

21
LINES

< > BotCompany Repo | #1017585 // StringMatcher

JavaX fragment (include)

1  
abstract sclass StringMatcher {
2  
  // change matches only if returning true
3  
  abstract bool match(S pat, S input, SS matches);
4  
  
5  
  // seems to be the same in all subclasses
6  
  S apply(S input, SS matches) {
7  
    ret ai_standardReplaceVars(input, matches);
8  
  }
9  
  
10  
  bool matchAnyPattern(Collection<S> patterns, S input, SS matches) {
11  
    for (S pat : unnull(patterns))
12  
      if (match(pat, input, matches)) true;
13  
    false;
14  
  }
15  
  
16  
  bool matchAnyInput(S pat, Collection<S> inputs, SS matches) {
17  
    for (S input : unnull(inputs))
18  
      if (match(pat, input, matches)) true;
19  
    false;
20  
  }
21  
}

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