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

!7

cmodule AnalyzeWifiOut > DynPrintLog {
  transient new Set<S> current;
  transient Set<S> lastSet;
  transient S date = null;
  transient new L<Change> log;
  
  sclass Change {
    S date;
    Set<S> newNetworks, disappearedNetworks;
  }
  
  start-thread {
    temp CloseableItIt<S> it = linesFromFile(userDir("wifi.out"));
    for (S s : it) {
      if (startsWith(s, "BSS"))
        current.add(s);
      else if (nempty(s)) {
        wrapUp();
        date = s;
        current = new Set;
      }
    }
    wrapUp();
    printShortLog();
  }
  
  void wrapUp {
    if (lastSet != null) {
      Set<S> newNetworks = setMinusSet(current, lastSet);
      Set<S> disappearedNetworks = setMinusSet(lastSet, current);
      if (nempty(newNetworks) || nempty(disappearedNetworks)) {
        log.add(nu Change(+date, +newNetworks, +disappearedNetworks));
        print(date);
        for (S network : newNetworks) print("+" + network);
        for (S network : disappearedNetworks) print("-" + network);
      }
    }
    lastSet = current;
  }
  
  void printShortLog {
    print();
    for (Change c : log)
      print(c.date + ":"
        + (empty(c.newNetworks) ? "" : " +" + l(c.newNetworks))
        + (empty(c.disappearedNetworks) ? "" : " -" + l(c.disappearedNetworks)));
  }
}

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: 324 / 593
Version history: 1 change(s)
Referenced in: [show references]