sonar fixes

This commit is contained in:
Armin Wolf 2020-04-05 19:59:10 +02:00
parent d7a8b10244
commit d1e725d73f
2 changed files with 16 additions and 16 deletions

View File

@ -13,9 +13,9 @@ import java.util.Objects;
*/
public class Line implements Comparable<Line> {
private static final double epsilon = 0.00001;
private static final Double min = 9999d;
private static final Double max = -9999d;
private static final double EPSILON = 0.00001;
private static final double MIN = 9999d;
private static final double MAX = -9999d;
@ -40,10 +40,10 @@ public class Line implements Comparable<Line> {
this.m = m;
this.b = b;
this.x1 = max;
this.y1 = (max * m) + b;
this.x2 = min * 0.5;
this.y2 = ((min * 0.5) * m) + b;
this.x1 = MAX;
this.y1 = (MAX * m) + b;
this.x2 = MIN * 0.5;
this.y2 = ((MIN * 0.5) * m) + b;
this.id = id;
}
@ -57,10 +57,10 @@ public class Line implements Comparable<Line> {
this.m = m;
this.b = b;
this.x1 = calculateX1(max);
this.y1 = calculateY1(max);
this.x2 = calculateX2(min * 0.5);
this.y2 = calculateY2(min * 0.5);
this.x1 = calculateX1(MAX);
this.y1 = calculateY1(MAX);
this.x2 = calculateX2(MIN * 0.5);
this.y2 = calculateY2(MIN * 0.5);
}
/**
@ -195,7 +195,7 @@ public class Line implements Comparable<Line> {
public boolean equals(Object obj) {
if (obj instanceof Line) {
Line other = (Line) obj;
return Precision.equals(other.getM(), this.getM(), epsilon) && Precision.equals(other.getB(), this.getB(), epsilon);
return Precision.equals(other.getM(), this.getM(), EPSILON) && Precision.equals(other.getB(), this.getB(), EPSILON);
} else {
return super.equals(obj);
}
@ -278,7 +278,7 @@ public class Line implements Comparable<Line> {
@Override
public int compareTo(Line line) {
if (Precision.compareTo(this.getM(), line.getM(), epsilon) == 0) {
if (Precision.compareTo(this.getM(), line.getM(), EPSILON) == 0) {
return this.getB().compareTo(line.getB());
} else {
return this.getM().compareTo(line.getM());

View File

@ -13,7 +13,7 @@ import java.util.Objects;
*/
public class Point implements Comparable<Point> {
private final double epsilon = 0.00001;
private static final double EPSILON = 0.00001;
private Double x;
private Double y;
@ -73,7 +73,7 @@ public class Point implements Comparable<Point> {
@Override
public int compareTo(Point o) {
if (Precision.compareTo(this.getX(), o.getX(), epsilon) == 0) {
if (Precision.compareTo(this.getX(), o.getX(), EPSILON) == 0) {
return this.getY().compareTo(o.getY());
} else {
return this.getX().compareTo(o.getX());
@ -90,7 +90,7 @@ public class Point implements Comparable<Point> {
public boolean equals(Object obj) {
if (obj instanceof Point) {
Point other = (Point) obj;
return Precision.equals(other.getX(), this.getX(), epsilon) && Precision.equals(other.getY(), this.getY(), epsilon);
return Precision.equals(other.getX(), this.getX(), EPSILON) && Precision.equals(other.getY(), this.getY(), EPSILON);
} else {
return super.equals(obj);
}