Skip to content

Instantly share code, notes, and snippets.

@up1
Created April 29, 2015 10:22
Show Gist options
  • Save up1/72d6f7948d5aa6b3f712 to your computer and use it in GitHub Desktop.
Save up1/72d6f7948d5aa6b3f712 to your computer and use it in GitHub Desktop.
Coding DOJO
Range has a lot of nifty issues.
integer range contains
[2,6) contains {2,4}
[2,6) doesn't contain {-1,1,6,10}
getAllPoints?
[2,6) allPoints = {2,3,4,5}
ContainsRange?
[2,5) doesn't contain [7,10)
[2,5) doesn't contain [3,10)
[3,5) doesn't contain [2,10)
[2,10) contains [3,5]
[3,5] contains [3,5)
endPoints
[2,6) allPoints = {2,3,4,5}
[2,6] allPoints = {2,3,4,5,6}
(2,6) allPoints = {3,4,5}
(2,6] allPoints = {3,4,5,6}
overlapsRange
[2,5) doesn't overlap with [7,10)
[2,10) overlaps with [3,5)
[3,5) overlaps with [3,5)
[2,5) overlaps with [3,10)
[3,5) overlaps with [2,10)
Equals
[3,5) equals [3,5)
[2,10) neq [3,5)
[2,5) neq [3,10)
[3,5) neq [2,10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment