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

51
LINES

< > BotCompany Repo | #1025132 // Operation GROUP Window Titles

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

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

!7

concept TitleSeen {
  S title;
}

cmodule OperationGroupSpike > DynPrintLog {
  L<Theory> theories = syncList();
  
  // a theory here is a list of things
  
  class Theory {
    IF1<S, Bool> checkExample;
    Set<S> examples;
    
    void lookAt(S example) {
      if (checkExample != null && checkExample.get(example))
        examples.add(example);
    }
  }
  
  class PrefixTheory > Theory {
    S prefix;
    
    { checkExample = s -> isPrefixOf(prefix, s); }
  }
  
  class SuffixTheory > Theory {
    S suffix;
    
    { checkExample = s -> isSuffixOf(suffix, s); }
  }
  
  start-thread {
    dbIndexing(TitleSeen, 'title);
    doEvery(3.0, rEnter gather);
  }
  
  void gather {
    L<virtual wmctrl_Entry> l = dm_windows();
    LS titles = collect windowTitle(l);
    oMap readTitle(this, titles);
  }
  
  void readTitle(S title) {
    if (uniq_trueIfNew(TitleSeen, +title)) print("New title: " + title);
    for (Theory theory : theories) pcall {
      theory.lookAt(title);
    }
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

-
Snippet ID: #1025132
Snippet name: Operation GROUP Window Titles
Eternal ID of this version: #1025132/8
Text MD5: a13bd8b7a68625d2320fce9a3b4b9af3
Transpilation MD5: f6403f0bcc18a7c894f530cd917d087f
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-08 18:00:06
Source code size: 1056 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 292 / 1113
Version history: 7 change(s)
Referenced in: