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

51
LINES

< > BotCompany Repo | #1010355 // RemoteLister - uses connection to another database [totally dev.]

JavaX fragment (include)

concept RemoteLister implements ILister {
  RemoteDB db;
  new HashMap<S, L> lists;
  new HashMap<S, Map> treeMaps;
  new HashMap<S, Set> treeSets;
  new HashMap<S, IVar> vars;
  
  public L getList(S name) {
    ret getList(name, ll());
  }
  
  public synchronized L getList(S name, L defaultList) {
    L l = lists.get(name);
    if (l == null) {
      lists.put(name, l = listInConcept(this, cloneList(defaultList)));
      change();
    }
    ret l;
  }
  
  public synchronized IVar getVar(S name, O defaultValue) {
    IVar v = vars.get(name);
    if (v == null) {
      vars.put(name, v = varInConcept(this, new Var));
      change();
    }
    if (!v.has() && defaultValue != null)
      v.set(defaultValue);
    ret v;
  }
  
  public synchronized Map getTreeMap(S name) {
    Map m = treeMaps.get(name);
    if (m == null) {
      treeMaps.put(name, m = mapInConcept(this, new TreeMap));
      change();
    }
    if (getOpt_raw(m, 'm) == null)
     fail("map not sane: " + className(m) + " " + struct(m));
    ret m;
  }
  
  public synchronized Set getTreeSet(S name) {
    Set m = treeSets.get(name);
    if (m == null) {
      treeSets.put(name, m = setInConcept(this, new TreeSet));
      change();
    }
    ret m;
  }  
}

Author comment

Began life as a copy of #1009401

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: #1010355
Snippet name: RemoteLister - uses connection to another database [totally dev.]
Eternal ID of this version: #1010355/1
Text MD5: 19ed995f185a71dddbf6eb5e3777244d
Author: stefan
Category: javax / lists
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-12 15:57:39
Source code size: 1289 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 372
Referenced in: