| 1 | package com.roxoft.lib; | |
| 2 | ||
| 3 | import java.util.Objects; | |
| 4 | ||
| 5 | public final class IntegerCoord2D { | |
| 6 | /** Cartesian x co-ordinate of location. */ | |
| 7 | private final int xCoordinate; | |
| 8 | /** Cartesian y co-ordinate of location. */ | |
| 9 | private final int yCoordinate; | |
| 10 | ||
| 11 | private IntegerCoord2D(final int x, | |
| 12 | final int y) { | |
| 13 | xCoordinate = x; | |
| 14 | yCoordinate = y; | |
| 15 | } | |
| 16 | ||
| 17 | /** | |
| 18 | * @param x Cartesian x co-ordinate of a 2D location. | |
| 19 | * @param y Cartesian y co-ordinate of a 2D location. | |
| 20 | * @return a {@link IntegerCoord2D} representation of x and y | |
| 21 | */ | |
| 22 | public static IntegerCoord2D of(final int x, final int y) { | |
| 23 |
1
1. of : replaced return value with null for com/roxoft/lib/IntegerCoord2D::of → KILLED |
return new IntegerCoord2D(x, y); |
| 24 | } | |
| 25 | ||
| 26 | /** | |
| 27 | * @return Cartesian x co-ordinate of location. | |
| 28 | */ | |
| 29 | public int getX() { | |
| 30 |
1
1. getX : replaced int return with 0 for com/roxoft/lib/IntegerCoord2D::getX → KILLED |
return xCoordinate; |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * @return Cartesian x co-ordinate of location. | |
| 35 | */ | |
| 36 | public int getY() { | |
| 37 |
1
1. getY : replaced int return with 0 for com/roxoft/lib/IntegerCoord2D::getY → KILLED |
return yCoordinate; |
| 38 | } | |
| 39 | ||
| 40 | @Override | |
| 41 | public String toString() { | |
| 42 |
1
1. toString : replaced return value with "" for com/roxoft/lib/IntegerCoord2D::toString → KILLED |
return "Loc (" |
| 43 | + xCoordinate | |
| 44 | + ", " | |
| 45 | + yCoordinate | |
| 46 | + ")"; | |
| 47 | } | |
| 48 | ||
| 49 | @Override | |
| 50 | public boolean equals(final Object o) { | |
| 51 |
1
1. equals : negated conditional → KILLED |
if (this == o) { |
| 52 |
1
1. equals : replaced boolean return with false for com/roxoft/lib/IntegerCoord2D::equals → KILLED |
return true; |
| 53 | } | |
| 54 |
2
1. equals : negated conditional → KILLED 2. equals : negated conditional → KILLED |
if (o == null || getClass() != o.getClass()) { |
| 55 |
1
1. equals : replaced boolean return with true for com/roxoft/lib/IntegerCoord2D::equals → KILLED |
return false; |
| 56 | } | |
| 57 | IntegerCoord2D coord2D = (IntegerCoord2D) o; | |
| 58 |
3
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with true for com/roxoft/lib/IntegerCoord2D::equals → KILLED 3. equals : negated conditional → KILLED |
return xCoordinate == coord2D.xCoordinate && yCoordinate == coord2D.yCoordinate; |
| 59 | } | |
| 60 | ||
| 61 | @Override | |
| 62 | public int hashCode() { | |
| 63 |
1
1. hashCode : replaced int return with 0 for com/roxoft/lib/IntegerCoord2D::hashCode → KILLED |
return Objects.hash(xCoordinate, yCoordinate); |
| 64 | } | |
| 65 | } | |
Mutations | ||
| 23 |
1.1 |
|
| 30 |
1.1 |
|
| 37 |
1.1 |
|
| 42 |
1.1 |
|
| 51 |
1.1 |
|
| 52 |
1.1 |
|
| 54 |
1.1 2.2 |
|
| 55 |
1.1 |
|
| 58 |
1.1 2.2 3.3 |
|
| 63 |
1.1 |