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

32
LINES

< > BotCompany Repo | #1032842 // Stages

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9256L/51K).

1  
// goes well with the stage {} macro (see tok_stages)
2  
srecord Stages(new L</*Stage*/Runnable> stages) is Steppable, Runnable {
3  
  replace Stage with Runnable.
4  
  int iStage;
5  
  Stage stage;
6  
  
7  
  public bool step() {
8  
    // What is this funny syntax
9  
    ret iStage <= l(stages)
10  
      && trueBecause(callF(stage = _get(stages, iStage++)));
11  
  }
12  
  
13  
  Stage stage(Stage stage) {
14  
    stages.add(stage);
15  
    ret stage;
16  
  }
17  
  
18  
  Stage stage(S name, Stage stage) {
19  
    ret stage(runnableWithCustomToString(name, stage));
20  
  }
21  
  
22  
  run { stepAll(this); }
23  
  
24  
  int indexOfStage(Stage stage) {
25  
    ret stages.indexOf(stage);
26  
  }
27  
  
28  
  void stepUntilStage(Stage stage) {
29  
    int index = indexOfStage(stage);
30  
    while (iStage <= index && step()) {}
31  
  }
32  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032842
Snippet name: Stages
Eternal ID of this version: #1032842/10
Text MD5: f01ccff7d838023d297953e45d2a3f35
Transpilation MD5: 201c8738c9262e2dea14f89a2746fd73
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-06 18:40:03
Source code size: 767 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 164 / 321
Version history: 9 change(s)
Referenced in: [show references]