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

46
LINES

< > BotCompany Repo | #1008190 // ThoughtSpace

JavaX fragment (include)

sclass ThoughtSpace {
  S globalID;
  new LinkedHashMap<S, LispStatement> statements;
  new HashMap<Lisp, LispStatement> statementsIndex;
  new LinkedHashMap<S, SimpleConcept> concepts;
  long changes;
  
  *() {}
  *(S *globalID) {}
  
  void addStatements(L<Lisp> l) { for (Lisp x : l) addStatement(x); }
  void addLispStatements(Collection<LispStatement> l) {
    for (LispStatement x : l) addStatement(x);
  }
  
  void addStatement(Lisp l) {
    if (!containsStatement(l)) addStatement(new LispStatement(l));
  }
  
  void addStatement(LispStatement s) {
    statements.put(s.globalID, s);
    statementsIndex.put(s.term, s);
    ++changes;
  }
  
  void removeStatement(S statementID) {
    removeStatement(statements.get(statementID));
  }
  
  void removeStatement(LispStatement s) {
    if (s != null) removeStatement(s.term);
  }
  
  void removeStatement(Lisp l) {
    LispStatement s = statementsIndex.get(l);
    if (s != null) {
      statements.remove(s.globalID);
      statementsIndex.remove(l);
      ++changes;
    }
  }
  
  bool containsStatement(Lisp l) {
    ret statementsIndex.containsKey(l);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008190
Snippet name: ThoughtSpace
Eternal ID of this version: #1008190/13
Text MD5: d7c1ff265dd9cb51c1c84c576c85799e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-07 00:36:04
Source code size: 1168 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 559 / 1275
Version history: 12 change(s)
Referenced in: [show references]