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

19
LINES

< > BotCompany Repo | #1008631 // class IntRange - range of ints (start/end)

JavaX fragment (include)

1  
// it's unclear whether the end is inclusive or exclusive
2  
// (usually exclusive I guess)
3  
sclass IntRange {
4  
  int start, end;
5  
  
6  
  *() {}
7  
  *(int *start, int *end) {}
8  
  *(IntRange r) { start = r.start; end = r.end; }
9  
  
10  
  [stdEq]
11  
  
12  
  final int length() { ret end-start; }
13  
  final bool empty() { ret start >= end; }
14  
  final bool isEmpty() { ret start >= end; }
15  
  
16  
  sS _fieldOrder = "start end";
17  
  
18  
  toString { ret "[" + start + ";" + end + "]"; }
19  
}

Author comment

Began life as a copy of #1005873

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1008631
Snippet name: class IntRange - range of ints (start/end)
Eternal ID of this version: #1008631/16
Text MD5: 916593858eb81b15e9f5e9992fe20e12
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-10 00:30:43
Source code size: 467 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 527 / 2051
Version history: 15 change(s)
Referenced in: [show references]