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

23
LINES

< > BotCompany Repo | #1036153 // Convergent - Converging value calculation

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

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

1  
abstract sclass Convergent<A> extends ItIt<A> {
2  
  A value;
3  
  bool stepped, done;
4  
  
5  
  public bool hasNext() {
6  
    if (done) false;
7  
    
8  
    if (!stepped) {
9  
      stepped = true;
10  
      step();
11  
    }
12  
    
13  
    ret !done;
14  
  }
15  
  
16  
  public A next() {
17  
    assertTrue(hasNext());
18  
    stepped = false;
19  
    ret value;
20  
  }
21  
  
22  
  abstract void step();
23  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036153
Snippet name: Convergent - Converging value calculation
Eternal ID of this version: #1036153/1
Text MD5: d1238c13863acfbeb23bde03e0da6d39
Transpilation MD5: c5c83e9506659c6ed886cd5776427215
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-01 06:22:14
Source code size: 362 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 61 / 96
Referenced in: [show references]