| 1 | package com.roxoft.lib; | |
| 2 | ||
| 3 | public final class Coord2DComparison { | |
| 4 | /** First comparison object. */ | |
| 5 | private final IntegerCoord2D coordA; | |
| 6 | /** Second comparison object. */ | |
| 7 | private final IntegerCoord2D coordB; | |
| 8 | ||
| 9 | private Coord2DComparison(final IntegerCoord2D first, final IntegerCoord2D second) { | |
| 10 | this.coordA = first; | |
| 11 | this.coordB = second; | |
| 12 | } | |
| 13 | ||
| 14 | /** | |
| 15 | * @param a The first {@link IntegerCoord2D} to be compared. | |
| 16 | * @param b The second {@link IntegerCoord2D} to be compared. | |
| 17 | * @return a new {@link Coord2DComparison} representing both {@link IntegerCoord2D} objects, ready to be compared. | |
| 18 | */ | |
| 19 | public static Coord2DComparison with(final IntegerCoord2D a, final IntegerCoord2D b) { | |
| 20 |
1
1. with : replaced return value with null for com/roxoft/lib/Coord2DComparison::with → KILLED |
return new Coord2DComparison(a, b); |
| 21 | } | |
| 22 | ||
| 23 | /** | |
| 24 | * @return the {@link Math#floor(double)}ed midpoint of two {@link IntegerCoord2D}. | |
| 25 | */ | |
| 26 | public IntegerCoord2D midpoint() { | |
| 27 |
2
1. midpoint : Replaced integer division with multiplication → KILLED 2. midpoint : Replaced integer addition with subtraction → KILLED |
final int averageX = (coordA.getX() + coordB.getX()) / 2; |
| 28 |
2
1. midpoint : Replaced integer division with multiplication → KILLED 2. midpoint : Replaced integer addition with subtraction → KILLED |
final int averageY = (coordA.getY() + coordB.getY()) / 2; |
| 29 | ||
| 30 |
1
1. midpoint : replaced return value with null for com/roxoft/lib/Coord2DComparison::midpoint → KILLED |
return IntegerCoord2D.of(averageX, averageY); |
| 31 | } | |
| 32 | } | |
Mutations | ||
| 20 |
1.1 |
|
| 27 |
1.1 2.2 |
|
| 28 |
1.1 2.2 |
|
| 30 |
1.1 |