Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
a9b6756d
Commit
a9b6756d
authored
Feb 18, 2026
by
Luna Riegel
Browse files
Refactor: Improve toString() method
parent
a193a6c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/CollisionRecord.java
View file @
a9b6756d
...
...
@@ -4,6 +4,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlId
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
org.jspecify.annotations.NonNull
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
...
...
@@ -11,6 +12,7 @@ import java.util.Collections;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.StringJoiner
;
public
record
CollisionRecord
(
Geometry
subjectGeom
,
Geometry
collidingGeom
,
GmlId
subjectFeatureId
,
...
...
@@ -33,4 +35,27 @@ public record CollisionRecord(Geometry subjectGeom, Geometry collidingGeom, GmlI
return
Collections
.
unmodifiableMap
(
collisionMap
);
}
@Override
public
@NonNull
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"CollisionRecord{ "
);
sb
.
append
(
"subjectFeature="
).
append
(
subjectFeatureId
).
append
(
"; "
);
sb
.
append
(
"subjectGeom="
).
append
(
subjectGeom
).
append
(
"; "
);
sb
.
append
(
"collidingFeature="
).
append
(
collidingFeatureId
).
append
(
"; "
);
sb
.
append
(
"collidingGeom="
).
append
(
collidingGeom
).
append
(
"; "
);
sb
.
append
(
"collisionMap="
);
StringJoiner
joiner
=
new
StringJoiner
(
", "
,
"["
,
"]; "
);
for
(
Map
.
Entry
<
Polygon
,
List
<
Polygon
>>
entry
:
collisionMap
.
entrySet
())
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"{ subjectPolygon="
).
append
(
entry
.
getKey
()).
append
(
"; "
);
StringJoiner
sj
=
new
StringJoiner
(
", "
,
"["
,
"]; "
);
sj
.
setEmptyValue
(
"NULL"
);
entry
.
getValue
().
forEach
(
poly
->
sj
.
add
(
poly
.
toString
()));
builder
.
append
(
"collidingPolygons="
).
append
(
sj
).
append
(
"} "
);
joiner
.
add
(
builder
.
toString
());
}
sb
.
append
(
joiner
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment