Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. /**
  2. * Compares two <code>Range</code> instances by their widths.
  3. *
  4. * @param r1
  5. * a Range
  6. * @param r2
  7. * a second Range
  8. * @return the value 0 if both Range instances are equal; -1 if r1 is
  9. * narrower than r2; and 1 if r1 is wider than r2
  10. */
  11. public static int compareTo(Range r1, Range r2) {
  12. int result;
  13. if (r1 == r2) {
  14. result = 0;
  15. } else if (r1.getMinimum() >= r1.getMinimum()) {
  16. result = 1;
  17. } else {
  18. result = -1;
  19. }
  20. return result;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement