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

1  
!7
2  
3  
concept TitleSeen {
4  
  S title;
5  
}
6  
7  
cmodule OperationGroupSpike > DynPrintLog {
8  
  L<Theory> theories = syncList();
9  
  
10  
  // a theory here is a list of things
11  
  
12  
  class Theory {
13  
    IF1<S, Bool> checkExample;
14  
    Set<S> examples;
15  
    
16  
    void lookAt(S example) {
17  
      if (checkExample != null && checkExample.get(example))
18  
        examples.add(example);
19  
    }
20  
  }
21  
  
22  
  class PrefixTheory > Theory {
23  
    S prefix;
24  
    
25  
    { checkExample = s -> isPrefixOf(prefix, s); }
26  
  }
27  
  
28  
  class SuffixTheory > Theory {
29  
    S suffix;
30  
    
31  
    { checkExample = s -> isSuffixOf(suffix, s); }
32  
  }
33  
  
34  
  start-thread {
35  
    dbIndexing(TitleSeen, 'title);
36  
    doEvery(3.0, rEnter gather);
37  
  }
38  
  
39  
  void gather {
40  
    L<virtual wmctrl_Entry> l = dm_windows();
41  
    LS titles = collect windowTitle(l);
42  
    oMap readTitle(this, titles);
43  
  }
44  
  
45  
  void readTitle(S title) {
46  
    if (uniq_trueIfNew(TitleSeen, +title)) print("New title: " + title);
47  
    for (Theory theory : theories) pcall {
48  
      theory.lookAt(title);
49  
    }
50  
  }
51  
}

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