Changeset 7864 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java
- Timestamp:
- 2014-12-20T22:43:20+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java
r7069 r7864 13 13 public static final Range ZERO_TO_INFINITY = new Range(0.0, Double.POSITIVE_INFINITY); 14 14 15 /** 16 * Constructs a new {@code Range}. 17 * @param lower Lower bound. Must be positive or zero 18 * @param upper Upper bound 19 * @throws IllegalArgumentException if the range is invalid ({@code lower < 0 || lower >= upper}) 20 */ 15 21 public Range(double lower, double upper) { 16 22 if (lower < 0 || lower >= upper) 17 throw new IllegalArgumentException( );23 throw new IllegalArgumentException("Invalid range: "+lower+"-"+upper); 18 24 this.lower = lower; 19 25 this.upper = upper; … … 29 35 public static Range cut(Range a, Range b) { 30 36 if (b.lower >= a.upper || b.upper <= a.lower) 31 throw new IllegalArgumentException( );37 throw new IllegalArgumentException("Ranges do not overlap: "+a+" - "+b); 32 38 return new Range(Math.max(a.lower, b.lower), Math.min(a.upper, b.upper)); 33 39 } … … 49 55 public Range reduceAround(double x, Range other) { 50 56 if (!contains(x)) 51 throw new IllegalArgumentException( );57 throw new IllegalArgumentException(x+" is not inside "+this); 52 58 if (other.contains(x)) 53 throw new IllegalArgumentException( );59 throw new IllegalArgumentException(x+" is inside "+other); 54 60 55 61 if (x < other.lower && other.lower < upper)
Note:
See TracChangeset
for help on using the changeset viewer.