@@ -41,8 +41,8 @@ public class Box implements Shape {
|
||||
*/
|
||||
public Box(Point first, Point second) {
|
||||
|
||||
Assert.notNull(first, "First point must not be null!");
|
||||
Assert.notNull(second, "Second point must not be null!");
|
||||
Assert.notNull(first, "First point must not be null");
|
||||
Assert.notNull(second, "Second point must not be null");
|
||||
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
@@ -56,8 +56,8 @@ public class Box implements Shape {
|
||||
*/
|
||||
public Box(double[] first, double[] second) {
|
||||
|
||||
Assert.isTrue(first.length == 2, "Point array has to have 2 elements!");
|
||||
Assert.isTrue(second.length == 2, "Point array has to have 2 elements!");
|
||||
Assert.isTrue(first.length == 2, "Point array has to have 2 elements");
|
||||
Assert.isTrue(second.length == 2, "Point array has to have 2 elements");
|
||||
|
||||
this.first = new Point(first[0], first[1]);
|
||||
this.second = new Point(second[0], second[1]);
|
||||
|
||||
@@ -43,9 +43,9 @@ public class Circle implements Shape {
|
||||
@PersistenceConstructor
|
||||
public Circle(Point center, Distance radius) {
|
||||
|
||||
Assert.notNull(center, "Center point must not be null!");
|
||||
Assert.notNull(radius, "Radius must not be null!");
|
||||
Assert.isTrue(radius.getValue() >= 0, "Radius must not be negative!");
|
||||
Assert.notNull(center, "Center point must not be null");
|
||||
Assert.notNull(radius, "Radius must not be null");
|
||||
Assert.isTrue(radius.getValue() >= 0, "Radius must not be negative");
|
||||
|
||||
this.center = center;
|
||||
this.radius = radius;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CustomMetric implements Metric {
|
||||
*/
|
||||
public CustomMetric(double multiplier, String abbreviation) {
|
||||
|
||||
Assert.notNull(abbreviation, "Abbreviation must not be null!");
|
||||
Assert.notNull(abbreviation, "Abbreviation must not be null");
|
||||
|
||||
this.multiplier = multiplier;
|
||||
this.abbreviation = abbreviation;
|
||||
|
||||
@@ -61,7 +61,7 @@ public final class Distance implements Serializable, Comparable<Distance> {
|
||||
*/
|
||||
public Distance(double value, Metric metric) {
|
||||
|
||||
Assert.notNull(metric, "Metric must not be null!");
|
||||
Assert.notNull(metric, "Metric must not be null");
|
||||
|
||||
this.value = value;
|
||||
this.metric = metric;
|
||||
@@ -119,7 +119,7 @@ public final class Distance implements Serializable, Comparable<Distance> {
|
||||
*/
|
||||
public Distance add(Distance other) {
|
||||
|
||||
Assert.notNull(other, "Distance to add must not be null!");
|
||||
Assert.notNull(other, "Distance to add must not be null");
|
||||
|
||||
double newNormalizedValue = getNormalizedValue() + other.getNormalizedValue();
|
||||
|
||||
@@ -135,8 +135,8 @@ public final class Distance implements Serializable, Comparable<Distance> {
|
||||
*/
|
||||
public Distance add(Distance other, Metric metric) {
|
||||
|
||||
Assert.notNull(other, "Distance to must not be null!");
|
||||
Assert.notNull(metric, "Result metric must not be null!");
|
||||
Assert.notNull(other, "Distance to must not be null");
|
||||
Assert.notNull(metric, "Result metric must not be null");
|
||||
|
||||
double newLeft = getNormalizedValue() * metric.getMultiplier();
|
||||
double newRight = other.getNormalizedValue() * metric.getMultiplier();
|
||||
@@ -153,7 +153,7 @@ public final class Distance implements Serializable, Comparable<Distance> {
|
||||
*/
|
||||
public Distance in(Metric metric) {
|
||||
|
||||
Assert.notNull(metric, "Metric must not be null!");
|
||||
Assert.notNull(metric, "Metric must not be null");
|
||||
|
||||
return this.metric.equals(metric) ? this : new Distance(getNormalizedValue() * metric.getMultiplier(), metric);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public class GeoResults<T> implements Iterable<GeoResult<T>>, Serializable {
|
||||
@PersistenceConstructor
|
||||
public GeoResults(List<? extends GeoResult<T>> results, Distance averageDistance) {
|
||||
|
||||
Assert.notNull(results, "Results must not be null!");
|
||||
Assert.notNull(averageDistance, "Average Distance must not be null!");
|
||||
Assert.notNull(results, "Results must not be null");
|
||||
Assert.notNull(averageDistance, "Average Distance must not be null");
|
||||
|
||||
this.results = results;
|
||||
this.averageDistance = averageDistance;
|
||||
@@ -133,8 +133,8 @@ public class GeoResults<T> implements Iterable<GeoResult<T>>, Serializable {
|
||||
|
||||
private static Distance calculateAverageDistance(List<? extends GeoResult<?>> results, Metric metric) {
|
||||
|
||||
Assert.notNull(results, "Results must not be null!");
|
||||
Assert.notNull(metric, "Metric must not be null!");
|
||||
Assert.notNull(results, "Results must not be null");
|
||||
Assert.notNull(metric, "Metric must not be null");
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return new Distance(0, metric);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Point implements Serializable {
|
||||
*/
|
||||
public Point(Point point) {
|
||||
|
||||
Assert.notNull(point, "Source point must not be null!");
|
||||
Assert.notNull(point, "Source point must not be null");
|
||||
|
||||
this.x = point.x;
|
||||
this.y = point.y;
|
||||
|
||||
@@ -50,10 +50,10 @@ public class Polygon implements Iterable<Point>, Shape {
|
||||
*/
|
||||
public Polygon(Point x, Point y, Point z, Point... others) {
|
||||
|
||||
Assert.notNull(x, "X coordinate must not be null!");
|
||||
Assert.notNull(y, "Y coordinate must not be null!");
|
||||
Assert.notNull(z, "Z coordinate must not be null!");
|
||||
Assert.notNull(others, "Others must not be null!");
|
||||
Assert.notNull(x, "X coordinate must not be null");
|
||||
Assert.notNull(y, "Y coordinate must not be null");
|
||||
Assert.notNull(z, "Z coordinate must not be null");
|
||||
Assert.notNull(others, "Others must not be null");
|
||||
|
||||
List<Point> points = new ArrayList<>(3 + others.length);
|
||||
points.addAll(Arrays.asList(x, y, z));
|
||||
@@ -70,13 +70,13 @@ public class Polygon implements Iterable<Point>, Shape {
|
||||
@PersistenceConstructor
|
||||
public Polygon(List<? extends Point> points) {
|
||||
|
||||
Assert.notNull(points, "Points must not be null!");
|
||||
Assert.notNull(points, "Points must not be null");
|
||||
|
||||
List<Point> pointsToSet = new ArrayList<>(points.size());
|
||||
|
||||
for (Point point : points) {
|
||||
|
||||
Assert.notNull(point, "Single Point in Polygon must not be null!");
|
||||
Assert.notNull(point, "Single Point in Polygon must not be null");
|
||||
pointsToSet.add(point);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public enum DistanceFormatter implements Converter<String, Distance>, Formatter<
|
||||
INSTANCE;
|
||||
|
||||
private static final Map<String, Metric> SUPPORTED_METRICS;
|
||||
private static final String INVALID_DISTANCE = "Expected double amount optionally followed by a metrics abbreviation (%s) but got '%s'!";
|
||||
private static final String INVALID_DISTANCE = "Expected double amount optionally followed by a metrics abbreviation (%s) but got '%s'";
|
||||
|
||||
static {
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public enum PointFormatter implements Converter<String, Point>, Formatter<Point>
|
||||
|
||||
public static final ConvertiblePair CONVERTIBLE = new ConvertiblePair(String.class, Point.class);
|
||||
|
||||
private static final String INVALID_FORMAT = "Expected two doubles separated by a comma but got '%s'!";
|
||||
private static final String INVALID_FORMAT = "Expected two doubles separated by a comma but got '%s'";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user