Skip to content

Commit 98d9c90

Browse files
committed
Align with v1.5.x
1 parent 020c085 commit 98d9c90

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

src/main/java/org/jfree/data/Range.java

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2222
* USA.
2323
*
24-
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
24+
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2525
* Other names may be trademarks of their respective owners.]
2626
*
2727
* ----------
@@ -34,7 +34,8 @@
3434
* Bill Kelemen;
3535
* Nicolas Brodu;
3636
* Sergei Ivanov;
37-
*
37+
* Tracy Hiltbrand (equals complies with EqualsVerifier);
38+
*
3839
*/
3940

4041
package org.jfree.data;
@@ -145,8 +146,6 @@ public boolean intersects(double b0, double b1) {
145146
* @param range another range ({@code null} not permitted).
146147
*
147148
* @return A boolean.
148-
*
149-
* @since 1.0.9
150149
*/
151150
public boolean intersects(Range range) {
152151
return intersects(range.getLowerBound(), range.getUpperBound());
@@ -202,16 +201,14 @@ public static Range combine(Range range1, Range range2) {
202201
}
203202

204203
/**
205-
* Returns a new range that spans both {@code range1} and
204+
* Returns a new range that spans both {@code range1} and
206205
* {@code range2}. This method has a special handling to ignore
207206
* Double.NaN values.
208207
*
209208
* @param range1 the first range ({@code null} permitted).
210209
* @param range2 the second range ({@code null} permitted).
211210
*
212211
* @return A new range (possibly {@code null}).
213-
*
214-
* @since 1.0.15
215212
*/
216213
public static Range combineIgnoringNaN(Range range1, Range range2) {
217214
if (range1 == null) {
@@ -233,15 +230,15 @@ public static Range combineIgnoringNaN(Range range1, Range range2) {
233230
}
234231
return new Range(l, u);
235232
}
236-
233+
237234
/**
238-
* Returns the minimum value. If either value is NaN, the other value is
235+
* Returns the minimum value. If either value is NaN, the other value is
239236
* returned. If both are NaN, NaN is returned.
240-
*
237+
*
241238
* @param d1 value 1.
242239
* @param d2 value 2.
243-
*
244-
* @return The minimum of the two values.
240+
*
241+
* @return The minimum of the two values.
245242
*/
246243
private static double min(double d1, double d2) {
247244
if (Double.isNaN(d1)) {
@@ -271,8 +268,6 @@ private static double max(double d1, double d2) {
271268
* @param value the value that must be included.
272269
*
273270
* @return A range.
274-
*
275-
* @since 1.0.1
276271
*/
277272
public static Range expandToInclude(Range range, double value) {
278273
if (range == null) {
@@ -378,8 +373,6 @@ else if (value < 0.0) {
378373
* @param factor the scaling factor (must be non-negative).
379374
*
380375
* @return A new range.
381-
*
382-
* @since 1.0.9
383376
*/
384377
public static Range scale(Range base, double factor) {
385378
Args.nullNotPermitted(base, "base");
@@ -403,41 +396,36 @@ public boolean equals(Object obj) {
403396
return false;
404397
}
405398
Range range = (Range) obj;
406-
if (!(this.lower == range.lower)) {
399+
if (Double.doubleToLongBits(this.lower) !=
400+
Double.doubleToLongBits(range.lower)) {
407401
return false;
408402
}
409-
if (!(this.upper == range.upper)) {
403+
if (Double.doubleToLongBits(this.upper) !=
404+
Double.doubleToLongBits(range.upper)) {
410405
return false;
411406
}
412407
return true;
413408
}
414409

415410
/**
416-
* Returns {@code true} if both the lower and upper bounds are
411+
* Returns {@code true} if both the lower and upper bounds are
417412
* {@code Double.NaN}, and {@code false} otherwise.
418-
*
413+
*
419414
* @return A boolean.
420-
*
421-
* @since 1.0.18
422415
*/
423416
public boolean isNaNRange() {
424417
return Double.isNaN(this.lower) && Double.isNaN(this.upper);
425418
}
426-
419+
427420
/**
428421
* Returns a hash code.
429422
*
430423
* @return A hash code.
431424
*/
432425
@Override
433426
public int hashCode() {
434-
int result;
435-
long temp;
436-
temp = Double.doubleToLongBits(this.lower);
437-
result = (int) (temp ^ (temp >>> 32));
438-
temp = Double.doubleToLongBits(this.upper);
439-
result = 29 * result + (int) (temp ^ (temp >>> 32));
440-
return result;
427+
int result = Double.hashCode(this.lower);
428+
return 29 * result + Double.hashCode(this.upper);
441429
}
442430

443431
/**

0 commit comments

Comments
 (0)