Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccasc committed Oct 1, 2020
1 parent 3020d63 commit cbdbae9
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/controller/IndoorHelperController.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,11 @@ public void unsetSpecificKeyFilter(String key) {
// After that unset the disabled status.
for (OsmPrimitive primitive : primitiveCollection) {
if ((primitive.isDisabledAndHidden() || primitive.isDisabled()) && primitive.hasKey(key)) {
for (Map.Entry<String, String> entry : primitive.getInterestingTags().entrySet()) {
if (entry.getKey().equals(key)) {
// Compare values to current working level
new Thread(() -> {
if (IndoorLevel.isPartOfWorkingLevel(entry.getValue(), level)) {
primitive.unsetDisabledState();
} else {
primitive.setDisabledType(true);
}
}).start();
new Thread(() -> {
if (IndoorLevel.isPartOfWorkingLevel(primitive.get(key), level)) {
primitive.unsetDisabledState();
}
}
}).start();
}
}
}
Expand Down

1 comment on commit cbdbae9

@GerdP
Copy link

@GerdP GerdP commented on cbdbae9 Oct 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not try it, but it looks very inefficient to start a new thread for possibly lots of disabled objects. My approach would be to collect the primitives first and start one thread if the collection is not empty.

Please sign in to comment.