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

18
LINES

< > BotCompany Repo | #1008066 // SelectBot using "match" method

JavaX fragment (include)

1  
sclass SelectBot extends Concept {
2  
  new TreeMap<S, Bool> examples;
3  
  new TreeMap<S, Bool> guessed;
4  
  transient S lastMatch; // not used
5  
  
6  
  void put(S s, Bool value) {
7  
    examples.put(s, value);
8  
    guessed.remove(s);
9  
    change();
10  
  }
11  
12  
  Bool get(S s) {
13  
    Bool value = guess_match(filterByValue(examples, Bool.TRUE), s);
14  
    if (neq(examples.get(s), value))
15  
      if (mapPutIfChange(guessed, s, value)) change();
16  
    ret value;
17  
  }
18  
}

Author comment

Began life as a copy of #1008054

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008066
Snippet name: SelectBot using "match" method
Eternal ID of this version: #1008066/5
Text MD5: d4ff6c885f21acf5bf526ac965e52800
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-23 13:57:16
Source code size: 456 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 448 / 769
Version history: 4 change(s)
Referenced in: [show references]