Skip to content

Commit

Permalink
FixtureFilterTableModel: Use Stream.of() to condense constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjon3377 committed Nov 23, 2024
1 parent 891e01c commit 1381bb4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions main/src/main/java/drivers/map_viewer/FixtureFilterTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import javax.swing.table.AbstractTableModel;

Expand Down Expand Up @@ -84,13 +85,8 @@ public FixtureFilterTableModel() {
// TODO: break up by owner beyond owned/independent
FixtureMatcher.complements(Village.class, v -> v.owner().isIndependent(),
"Independent Villages", "Villages With Suzerain").forEach(matchers::add);
// TODO: Use for-each loops and Arrays.asList() to condense stretches where we don't provide the plural
matchers.add(FixtureMatcher.trivialMatcher(Mine.class));
matchers.add(FixtureMatcher.trivialMatcher(Troll.class));
matchers.add(FixtureMatcher.trivialMatcher(Simurgh.class));
matchers.add(FixtureMatcher.trivialMatcher(Ogre.class));
matchers.add(FixtureMatcher.trivialMatcher(Minotaur.class));
matchers.add(FixtureMatcher.trivialMatcher(Griffin.class));
Stream.of(Mine.class, Troll.class, Simurgh.class, Ogre.class,
Minotaur.class, Griffin.class).map(FixtureMatcher::trivialMatcher).forEach(matchers::add);
matchers.add(FixtureMatcher.trivialMatcher(Sphinx.class, "Sphinxes"));
matchers.add(FixtureMatcher.trivialMatcher(Phoenix.class, "Phoenixes"));
matchers.add(FixtureMatcher.trivialMatcher(Djinn.class, "Djinni"));
Expand All @@ -99,12 +95,8 @@ public FixtureFilterTableModel() {
matchers.add(FixtureMatcher.trivialMatcher(Giant.class));
matchers.add(FixtureMatcher.trivialMatcher(Dragon.class));
matchers.add(FixtureMatcher.trivialMatcher(Pegasus.class, "Pegasi"));
matchers.add(FixtureMatcher.trivialMatcher(Snowbird.class));
matchers.add(FixtureMatcher.trivialMatcher(Thunderbird.class));
matchers.add(FixtureMatcher.trivialMatcher(Unicorn.class));
matchers.add(FixtureMatcher.trivialMatcher(Kraken.class));
matchers.add(FixtureMatcher.trivialMatcher(Cave.class));
matchers.add(FixtureMatcher.trivialMatcher(Battlefield.class));
Stream.of(Snowbird.class, Thunderbird.class, Unicorn.class, Kraken.class, Cave.class, Battlefield.class)
.map(FixtureMatcher::trivialMatcher).forEach(matchers::add);
FixtureMatcher.complements(Animal.class, Animal::isTalking, "Talking Animals", "Animals")
.forEach(matchers::add);
matchers.add(FixtureMatcher.trivialMatcher(AnimalTracks.class, "Animal Tracks"));
Expand Down

0 comments on commit 1381bb4

Please sign in to comment.