Commit 97a65114 authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev' into 'master'

Version 3.15.0

See merge request !8
parents 99c8f6a8 5950ea5f
Pipeline #10106 passed with stage
in 3 minutes and 15 seconds
......@@ -23,7 +23,7 @@ import java.util.List;
public class PolyLine2d extends BaseEntity {
private PolyLineSegment2d mpFirst;
private final PolyLineSegment2d mpFirst;
private PolyLineSegment2d mpLast;
public PolyLine2d(PolyLineSegment2d pStart) {
......
......@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity {
private static final Logger logger = LogManager.getLogger(PolyLineSegment.class);
private Coordinate3d mpStart;
private Coordinate3d mpEnd;
private final Coordinate3d mpStart;
private final Coordinate3d mpEnd;
private PolyLineSegment mpNext;
......
......@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity {
point = halfEdge.getStart().getPoint();
lowerU = (point.getX() < lowerU) ? point.getX() : lowerU;
lowerV = (point.getY() < lowerV) ? point.getY() : lowerV;
lowerU = Math.min(point.getX(), lowerU);
lowerV = Math.min(point.getY(), lowerV);
upperU = (point.getX() > upperU) ? point.getX() : upperU;
upperV = (point.getY() > upperV) ? point.getY() : upperV;
upperU = Math.max(point.getX(), upperU);
upperV = Math.max(point.getY(), upperV);
}
Box2d box = new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
return box;
return new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
}
public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) {
......
......@@ -18,12 +18,13 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Polygon2dPolygon2dInt {
private Polygon2d mcpPolygon1;
private Polygon2d mcpPolygon2;
private PolyLine2d line;
private IntersectionType intType;
private final Polygon2d mcpPolygon1;
private final Polygon2d mcpPolygon2;
private final PolyLine2d line;
private final IntersectionType intType;
public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line,
IntersectionType intType) {
......
......@@ -18,12 +18,13 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
public class PolygonPolygonIntersection {
private EdgePolygon p1;
private EdgePolygon p2;
private PolyLine polyLine;
private IntersectionType type;
private final EdgePolygon p1;
private final EdgePolygon p2;
private final PolyLine polyLine;
private final IntersectionType type;
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) {
this.p1 = p1;
......
......@@ -18,10 +18,11 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
public class ProjectedPoint3d {
private Point3d point;
private double parameter;
private final Point3d point;
private final double parameter;
public ProjectedPoint3d(Point3d point, double d) {
this.point = point;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
public class UnitVector3d extends Vector3d {
public static UnitVector3d of(Vector3d vec) {
......@@ -37,13 +38,7 @@ public class UnitVector3d extends Vector3d {
public double dot(UnitVector3d other) {
double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
if (scalar > 1.0) {
return 1.0;
}
if (scalar < -1.0) {
return -1.0;
}
return scalar;
return (scalar >= 0) ? Math.min(scalar, 1.0) : Math.max(scalar, -1.0);
}
......
......@@ -18,16 +18,18 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
public class Vector2d {
private double x;
private double y;
private final double x;
private final double y;
public Vector2d(double x, double y) {
this.x = x;
this.y = y;
}
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x);
}
......
......@@ -18,11 +18,12 @@
*/
package de.hft.stuttgart.citydoctor2.edge;
import java.util.Arrays;
public class Vector3d {
private double[] val = new double[3];
private final double[] val = new double[3];
public Vector3d(double x, double y, double z) {
val[0] = x;
......@@ -46,9 +47,9 @@ public class Vector3d {
val[1] = 0;
val[2] = 0;
} else {
val[0] = val[0] /= length;
val[1] = val[1] /= length;
val[2] = val[2] /= length;
val[0] /= length;
val[1] /= length;
val[2] /= length;
}
}
......
......@@ -103,11 +103,11 @@ public class IntersectionErrorsTest {
}
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
......
......@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v1);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = polygons.get(0);
List<Coordinate3d> coordinates = edgePoly1.getCoordinates();
......@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest {
List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class);
assertEquals(2, coordChildren.size());
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
......@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
......@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v2);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
......@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v4);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
......@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
......
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.14.1</version>
<version>3.15.0</version>
</parent>
<properties>
<versionString>${project.version}-${git.commit.id.abbrev}</versionString>
......
......@@ -67,7 +67,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
*/
public abstract class Check {
private List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
@SuppressWarnings("unchecked")
protected Check() {
......
......@@ -79,7 +79,7 @@ public interface CheckError extends Serializable {
* implementor of the error decides which information is written into the report
* or shown on the GUI.
*
* @param report
* @param report the ErrorReport.
*/
public void report(ErrorReport report);
......
......@@ -18,10 +18,12 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
public class CheckId implements Serializable {
public record CheckId(String name) implements Serializable {
@Serial
private static final long serialVersionUID = -6267337828874296004L;
public static final CheckId C_GE_R_TOO_FEW_POINTS = new CheckId("C_GE_R_TOO_FEW_POINTS");
......@@ -55,23 +57,6 @@ public class CheckId implements Serializable {
public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME");
public static final CheckId C_SE_POLYGON_WITHOUT_SURFACE = new CheckId("C_SE_POLYGON_WITHOUT_SURFACE");
private String name;
public CheckId(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
......@@ -83,11 +68,8 @@ public class CheckId implements Serializable {
return false;
CheckId other = (CheckId) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
return other.name == null;
} else return name.equals(other.name);
}
@Override
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
/**
......@@ -29,6 +30,7 @@ import java.io.Serializable;
*/
public class CheckResult implements Serializable {
@Serial
private static final long serialVersionUID = -8775678793477525693L;
private final CheckId id;
......@@ -38,7 +40,7 @@ public class CheckResult implements Serializable {
/**
* Constructor for this container
*
* @param c the check which produced this result
* @param id the check which produced this result
* @param s the status of the result
* @param err an optional error object
*/
......@@ -66,15 +68,7 @@ public class CheckResult implements Serializable {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CheckResult [id=");
builder.append(id);
builder.append(", status=");
builder.append(status);
builder.append(", error=");
builder.append(err);
builder.append("]");
return builder.toString();
return String.format("CheckResult [id=%s, status=%s, error=%s]", id, status, err);
}
}
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
......@@ -36,11 +37,12 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
*/
public abstract class Checkable implements Serializable {
@Serial
private static final long serialVersionUID = -1707871839265057882L;
private static final Logger logger = LogManager.getLogger(Checkable.class);
private Map<CheckId, CheckResult> checkResults = new HashMap<>();
private final Map<CheckId, CheckResult> checkResults = new HashMap<>();
private boolean isValidated = false;
protected void setValidated(boolean validated) {
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
/**
......@@ -30,11 +31,12 @@ import java.io.Serializable;
*/
public class DefaultParameter implements Serializable {
@Serial
private static final long serialVersionUID = -4587211298078974066L;
private String name;
private String value;
private Unit unitType;
private final String name;
private final String value;
private final Unit unitType;
public DefaultParameter(String name, String defaultValue, Unit unitType) {
this.name = name;
......@@ -71,13 +73,7 @@ public class DefaultParameter implements Serializable {
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DefaultParameter [name=");
builder.append(name);
builder.append(", value=");
builder.append(value);
builder.append("]");
return builder.toString();
return "DefaultParameter [name=" + name + ", value=" + value + "]";
}
}
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
/**
......@@ -27,8 +28,9 @@ import java.io.Serializable;
* @author Matthias Betz
*
*/
public class ErrorId implements Serializable {
public record ErrorId(String name) implements Serializable {
@Serial
private static final long serialVersionUID = -2598466667746276560L;
public static final ErrorId DEPENDENCIES_NOT_MET = new ErrorId("Dependencies_not_met");
......@@ -65,11 +67,8 @@ public class ErrorId implements Serializable {
public static final ErrorId GE_P_DEGENERATED_RING = new ErrorId("GE_P_DEGENERATED_POLYGON");
public static final ErrorId SE_POLYGON_WITHOUT_SURFACE = new ErrorId("SE_POLYGON_WITHOUT_SURFACE");
private String name;
public ErrorId(String name) {
this.name = name;
}
@Override
public int hashCode() {
......@@ -89,11 +88,8 @@ public class ErrorId implements Serializable {
return false;
ErrorId other = (ErrorId) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
return other.name == null;
} else return name.equals(other.name);
}
@Override
......
......@@ -18,52 +18,17 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.Triangle3d;
public class GeometrySelfIntersection implements Serializable {
public record GeometrySelfIntersection(Polygon p1, Polygon p2, Triangle3d t1, Triangle3d t2) implements Serializable {
@Serial
private static final long serialVersionUID = -6308847898942670140L;
private Polygon p1;
private Polygon p2;
private Triangle3d t1;
private Triangle3d t2;
public GeometrySelfIntersection(Polygon p1, Polygon p2, Triangle3d t1, Triangle3d t2) {
super();
this.p1 = p1;
this.p2 = p2;
this.t1 = t1;
this.t2 = t2;
}
public Polygon getP1() {
return p1;
}
public void setP1(Polygon p1) {
this.p1 = p1;
}
public Polygon getP2() {
return p2;
}
public void setP2(Polygon p2) {
this.p2 = p2;
}
public Triangle3d getT1() {
return t1;
}
public Triangle3d getT2() {
return t2;
}
@Override
public String toString() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment