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)

// it's unclear whether the end is inclusive or exclusive
// (usually exclusive I guess)
sclass IntRange {
  int start, end;
  
  *() {}
  *(int *start, int *end) {}
  *(IntRange r) { start = r.start; end = r.end; }
  
  [stdEq]
  
  final int length() { ret end-start; }
  final bool empty() { ret start >= end; }
  final bool isEmpty() { ret start >= end; }
  
  sS _fieldOrder = "start end";
  
  toString { ret "[" + start + ";" + end + "]"; }
}

Author comment

Began life as a copy of #1005873

download  show line numbers  debug dex   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, 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: 361 / 1619
Version history: 15 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1008631 & http://1008631.tinybrain.de