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
c07d326d
Commit
c07d326d
authored
Apr 04, 2025
by
Riegel
Browse files
Refactor: Replace if-else with switch
parent
e4a745a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java
View file @
c07d326d
...
@@ -1161,27 +1161,18 @@ public class MainWindow extends Application {
...
@@ -1161,27 +1161,18 @@ public class MainWindow extends Application {
private
Pair
<
Tab
,
TreeView
<
Renderable
>>
getFeatureTabOf
(
CityObject
co
)
{
private
Pair
<
Tab
,
TreeView
<
Renderable
>>
getFeatureTabOf
(
CityObject
co
)
{
FeatureType
coType
=
co
.
getFeatureType
();
FeatureType
coType
=
co
.
getFeatureType
();
if
(
coType
==
FeatureType
.
BUILDING
){
return
switch
(
coType
)
{
return
new
Pair
<>(
buildingsTab
,
buildingsView
);
case
BUILDING
->
new
Pair
<>(
buildingsTab
,
buildingsView
);
}
else
if
(
coType
==
FeatureType
.
VEGETATION
){
case
VEGETATION
->
new
Pair
<>(
vegetationTab
,
vegetationView
);
return
new
Pair
<>(
vegetationTab
,
vegetationView
);
case
TRANSPORTATION
->
new
Pair
<>(
transportationTab
,
transView
);
}
else
if
(
coType
==
FeatureType
.
TRANSPORTATION
){
case
TUNNEL
->
new
Pair
<>(
tunnelTab
,
tunnelView
);
return
new
Pair
<>(
transportationTab
,
transView
);
case
BRIDGE
->
new
Pair
<>(
bridgeTab
,
bridgeView
);
}
else
if
(
coType
==
FeatureType
.
TUNNEL
){
case
WATER
->
new
Pair
<>(
waterTab
,
waterView
);
return
new
Pair
<>(
tunnelTab
,
tunnelView
);
case
LAND
->
new
Pair
<>(
terrainTab
,
terrainView
);
}
else
if
(
coType
==
FeatureType
.
BRIDGE
){
case
CITY_FURNITURE
->
new
Pair
<>(
cityFurnitureTab
,
cityFurnitureView
);
return
new
Pair
<>(
bridgeTab
,
bridgeView
);
case
GENERIC_CITY_OBJECT
->
new
Pair
<>(
otherObjectsTab
,
otherObjectsView
);
}
else
if
(
coType
==
FeatureType
.
WATER
){
default
->
throw
new
IllegalArgumentException
(
"unknown feature type: "
+
coType
);
return
new
Pair
<>(
waterTab
,
waterView
);
};
}
else
if
(
coType
==
FeatureType
.
LAND
){
return
new
Pair
<>(
terrainTab
,
terrainView
);
}
else
if
(
coType
==
FeatureType
.
CITY_FURNITURE
){
return
new
Pair
<>(
cityFurnitureTab
,
cityFurnitureView
);
}
else
if
(
coType
==
FeatureType
.
GENERIC_CITY_OBJECT
){
return
new
Pair
<>(
otherObjectsTab
,
otherObjectsView
);
}
else
{
throw
new
IllegalArgumentException
(
"unknown feature type: "
+
coType
);
}
}
}
public
MainToolBar
getMainToolbar
()
{
public
MainToolBar
getMainToolbar
()
{
...
...
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