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

12
LINES

< > BotCompany Repo | #1005874 // addToRange

JavaX fragment (include)

1  
// can overwrite original object!
2  
static Range addToRange(Range r, float val) {
3  
  if (r == null)
4  
    ret new Range(val);
5  
  if (r.min > r.max)
6  
    r.min = r.max = val;
7  
  else {
8  
    if (val < r.min) r.min = val;
9  
    if (val > r.max) r.max = val;
10  
  }
11  
  ret r;
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005874
Snippet name: addToRange
Eternal ID of this version: #1005874/1
Text MD5: 977ec4796842cbe11bf2d6d8ee2d4da9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-11 16:27:37
Source code size: 269 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 472 / 504
Referenced in: [show references]