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

50
LINES

< > BotCompany Repo | #1027037 // Analyze wifi.out (wifi location protocol)

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

Uses 911K of libraries. Click here for Pure Java version (2705L/14K).

1  
!7
2  
3  
cmodule AnalyzeWifiOut > DynPrintLog {
4  
  transient new Set<S> current;
5  
  transient Set<S> lastSet;
6  
  transient S date = null;
7  
  transient new L<Change> log;
8  
  
9  
  sclass Change {
10  
    S date;
11  
    Set<S> newNetworks, disappearedNetworks;
12  
  }
13  
  
14  
  start-thread {
15  
    temp CloseableItIt<S> it = linesFromFile(userDir("wifi.out"));
16  
    for (S s : it) {
17  
      if (startsWith(s, "BSS"))
18  
        current.add(s);
19  
      else if (nempty(s)) {
20  
        wrapUp();
21  
        date = s;
22  
        current = new Set;
23  
      }
24  
    }
25  
    wrapUp();
26  
    printShortLog();
27  
  }
28  
  
29  
  void wrapUp {
30  
    if (lastSet != null) {
31  
      Set<S> newNetworks = setMinusSet(current, lastSet);
32  
      Set<S> disappearedNetworks = setMinusSet(lastSet, current);
33  
      if (nempty(newNetworks) || nempty(disappearedNetworks)) {
34  
        log.add(nu Change(+date, +newNetworks, +disappearedNetworks));
35  
        print(date);
36  
        for (S network : newNetworks) print("+" + network);
37  
        for (S network : disappearedNetworks) print("-" + network);
38  
      }
39  
    }
40  
    lastSet = current;
41  
  }
42  
  
43  
  void printShortLog {
44  
    print();
45  
    for (Change c : log)
46  
      print(c.date + ":"
47  
        + (empty(c.newNetworks) ? "" : " +" + l(c.newNetworks))
48  
        + (empty(c.disappearedNetworks) ? "" : " -" + l(c.disappearedNetworks)));
49  
  }
50  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027037
Snippet name: Analyze wifi.out (wifi location protocol)
Eternal ID of this version: #1027037/2
Text MD5: 001b61b4008f60fc3b078db63cf1ea84
Transpilation MD5: d1a62bd27d7f12d1f4d7db2101602bfe
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-13 12:20:24
Source code size: 1335 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 325 / 595
Version history: 1 change(s)
Referenced in: [show references]