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

20
LINES

< > BotCompany Repo | #1017011 // generalDefinitions_remove

JavaX fragment (include)

1  
static Pair<Bool, S> generalDefinitions_remove(S word, S def) {
2  
  if (empty(word) || empty(def)) ret pair(false, "Empty");
3  
  
4  
  L<S> defs = mechMultiMapCI(generalDefinitions_listName()).get(word);
5  
  defs = definitions_dropInvalidated(defs);
6  
  
7  
  new SS globalIDs;
8  
  for (S found : defs)
9  
    if (eqic(dropGlobalID(found), def))
10  
      globalIDs.put(getAppendedGlobalID(found), dropGlobalID(found));
11  
      
12  
  if (empty(globalIDs))
13  
    ret pair(false, "Definition not there");
14  
    
15  
  for (S id, text : globalIDs) {
16  
    addToMechMap(generalDefinitions_listName(),
17  
      litmap(word, appendGlobalID("[invalidate " + id + ": " + text + "]")));
18  
  }
19  
  ret pair(true, "Definition removed " + n2(globalIDs, "time") + ": " + word + " = " + def);
20  
}

Author comment

Began life as a copy of #1017007

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: #1017011
Snippet name: generalDefinitions_remove
Eternal ID of this version: #1017011/6
Text MD5: 4112d817e98582f66798badf814e2153
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-10 16:43:07
Source code size: 754 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 366 / 401
Version history: 5 change(s)
Referenced in: [show references]