PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/Foundation/objj.platform/CPRange.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 43 lines | 43 code | 0 blank | 0 comment | 0 complexity | 91194d10f512b5c33f94f1d8af3bf07a MD5 | raw file
 1c;1225;
 2CPMakeRange=function(_1,_2){
 3return {location:_1,length:_2};
 4};
 5CPCopyRange=function(_3){
 6return {location:_3.location,length:_3.length};
 7};
 8CPMakeRangeCopy=function(_4){
 9return {location:_4.location,length:_4.length};
10};
11CPEmptyRange=function(_5){
12return _5.length===0;
13};
14CPMaxRange=function(_6){
15return _6.location+_6.length;
16};
17CPEqualRanges=function(_7,_8){
18return ((_7.location===_8.location)&&(_7.length===_8.length));
19};
20CPLocationInRange=function(_9,_a){
21return (_9>=_a.location)&&(_9<CPMaxRange(_a));
22};
23CPUnionRange=function(_b,_c){
24var _d=MIN(_b.location,_c.location);
25return CPMakeRange(_d,MAX(CPMaxRange(_b),CPMaxRange(_c))-_d);
26};
27CPIntersectionRange=function(_e,_f){
28if(CPMaxRange(_e)<_f.location||CPMaxRange(_f)<_e.location){
29return CPMakeRange(0,0);
30}
31var _10=MAX(_e.location,_f.location);
32return CPMakeRange(_10,MIN(CPMaxRange(_e),CPMaxRange(_f))-_10);
33};
34CPRangeInRange=function(_11,_12){
35return (_11.location<=_12.location&&CPMaxRange(_11)>=CPMaxRange(_12));
36};
37CPStringFromRange=function(_13){
38return "{"+_13.location+", "+_13.length+"}";
39};
40CPRangeFromString=function(_14){
41var _15=_14.indexOf(",");
42return {location:parseInt(_14.substr(1,_15-1)),length:parseInt(_14.substring(_15+1,_14.length))};
43};