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

41
LINES

< > BotCompany Repo | #1021927 // Indexed Simple Wikipedia [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1775K of libraries. Click here for Pure Java version (6361L/35K).

!7

cmodule IndexedSimpleWikipedia > DynPrintLog {
  transient volatile Map<S, WikiPage> theMap;
  transient volatile bool loadError;
  
  start {
    thread {
      try {
        theMap = indexedSimpleWikipedia_fast();
        print("Have " + n2(theMap, "topic") + ".");
        print("Ready.");
      } on fail {
        loadError = true;
      }
    }
    
    dm_registerAs('indexedSimpleWikipedia);
  }
  
  void waittt {
    if (theMap == null) {
      print("Waiting for Wikipedia to be loaded...");
      while (!loadError && theMap == null && licensed()) {
        sleepSeconds(1.0);
      }
    }
  }
  
  // API
  
  S textForTopic(S topic) {
    waittt();
    ret getString text(mapGet(theMap, topic));
  }
  
  Set<S> topics() {
    waittt();
    ret keys(theMap);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021927
Snippet name: Indexed Simple Wikipedia [Dyn Module]
Eternal ID of this version: #1021927/7
Text MD5: 36647d073554d9e4f7d3e4cc55f21caa
Transpilation MD5: a3405b50451397e53a0ff252508a4a7b
Author: stefan
Category: javax / a.i. / networking
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 19:20:46
Source code size: 823 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 277 / 553
Version history: 6 change(s)
Referenced in: [show references]