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

40
LINES

< > BotCompany Repo | #1002431 // Is A Bot (developing)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1311L/9K/29K).

!752

!include #1002461 // Source

static Relationship<S, Source> isA;

p {
  load("isA");
}

answer {
  L<S> tok = nlTok(s);
  int i = findCodeTokens(tok, true, "is", "a");
  if (i > 0) {
    
  }
}

// This is about (directed) pair relationships: A * A -> V
// For example, "A is a B" with V being a value type
static class Relationship<A, V> {
  Map<A, Map<A, V>> forward = new TreeMap;
  Map<A, Map<A, V>> backward = new TreeMap;
  
  V get(A a, A b) {
    Map<A, V> map = forward.get(a);
    ret map == null ? null : map.get(b);
  }
  
  void put(A a, A b, V v) {
    put1(forward, a, b, v);
    put1(backward, b, a, v);
  }
  
  void put1(Map<A, Map<A, V>> x, A a, A b, V v) {
    Map<A, V> map = x.get(a);
    if (map == null) x.put(a, map = new TreeMap);
    map.put(b, v);
  }
}

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: #1002431
Snippet name: Is A Bot (developing)
Eternal ID of this version: #1002431/1
Text MD5: b977dad73e594316fca35f59efa5f41b
Transpilation MD5: 73f625996a7a32513b1af54bb201075a
Author: stefan
Category: eleu
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-24 18:52:00
Source code size: 826 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 584 / 591
Referenced in: [show references]