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).

1  
!7
2  
3  
cmodule IndexedSimpleWikipedia > DynPrintLog {
4  
  transient volatile Map<S, WikiPage> theMap;
5  
  transient volatile bool loadError;
6  
  
7  
  start {
8  
    thread {
9  
      try {
10  
        theMap = indexedSimpleWikipedia_fast();
11  
        print("Have " + n2(theMap, "topic") + ".");
12  
        print("Ready.");
13  
      } on fail {
14  
        loadError = true;
15  
      }
16  
    }
17  
    
18  
    dm_registerAs('indexedSimpleWikipedia);
19  
  }
20  
  
21  
  void waittt {
22  
    if (theMap == null) {
23  
      print("Waiting for Wikipedia to be loaded...");
24  
      while (!loadError && theMap == null && licensed()) {
25  
        sleepSeconds(1.0);
26  
      }
27  
    }
28  
  }
29  
  
30  
  // API
31  
  
32  
  S textForTopic(S topic) {
33  
    waittt();
34  
    ret getString text(mapGet(theMap, topic));
35  
  }
36  
  
37  
  Set<S> topics() {
38  
    waittt();
39  
    ret keys(theMap);
40  
  }
41  
}

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: 222 / 476
Version history: 6 change(s)
Referenced in: [show references]