From f312719bf9df140a22406a4e40c5221a86cd8073 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 24 Nov 2015 21:56:22 +0100 Subject: Refactor Daedalus residence --- src/ch/epfl/maze/physical/stragegies/picker/BlindPicker.java | 4 ++-- .../epfl/maze/physical/stragegies/picker/ChoicePicker.java | 11 ++++++----- .../maze/physical/stragegies/reducer/BlindChoiceReducer.java | 4 ++-- .../epfl/maze/physical/stragegies/reducer/CaseReducer.java | 12 ++++++------ .../epfl/maze/physical/stragegies/reducer/ChoiceReducer.java | 8 ++++---- 5 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/ch/epfl/maze/physical/stragegies') diff --git a/src/ch/epfl/maze/physical/stragegies/picker/BlindPicker.java b/src/ch/epfl/maze/physical/stragegies/picker/BlindPicker.java index 6dcf229..02cb1ef 100644 --- a/src/ch/epfl/maze/physical/stragegies/picker/BlindPicker.java +++ b/src/ch/epfl/maze/physical/stragegies/picker/BlindPicker.java @@ -1,6 +1,6 @@ package ch.epfl.maze.physical.stragegies.picker; -import ch.epfl.maze.physical.World; +import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.util.Direction; import java.util.Set; @@ -13,7 +13,7 @@ import java.util.Set; public interface BlindPicker extends ChoicePicker { @Override - default Direction pick(Set choices, World world) { + default Direction pick(Set choices, Daedalus daedalus) { return this.pick(choices); } diff --git a/src/ch/epfl/maze/physical/stragegies/picker/ChoicePicker.java b/src/ch/epfl/maze/physical/stragegies/picker/ChoicePicker.java index 76fe3eb..756c446 100644 --- a/src/ch/epfl/maze/physical/stragegies/picker/ChoicePicker.java +++ b/src/ch/epfl/maze/physical/stragegies/picker/ChoicePicker.java @@ -1,5 +1,6 @@ package ch.epfl.maze.physical.stragegies.picker; +import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.physical.World; import ch.epfl.maze.util.Direction; import ch.epfl.maze.util.Vector2D; @@ -33,12 +34,12 @@ public interface ChoicePicker { * In this variation, the animal knows the world entirely. It can therefore * use the position of other animals in the daedalus to move more effectively. * - * @param choices The choices left to the animal at its current position (see - * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) - * World.getChoices(Vector2D)}) - * @param world The world in which the animal moves + * @param choices The choices left to the animal at its current position (see + * {@link World#getChoices(Vector2D) + * World.getChoices(Vector2D)}) + * @param daedalus The daedalus in which the animal moves * @return The next direction of the animal, chosen in {@code choices} */ - Direction pick(Set choices, World world); + Direction pick(Set choices, Daedalus daedalus); } diff --git a/src/ch/epfl/maze/physical/stragegies/reducer/BlindChoiceReducer.java b/src/ch/epfl/maze/physical/stragegies/reducer/BlindChoiceReducer.java index 169a8f6..2e8a198 100644 --- a/src/ch/epfl/maze/physical/stragegies/reducer/BlindChoiceReducer.java +++ b/src/ch/epfl/maze/physical/stragegies/reducer/BlindChoiceReducer.java @@ -1,6 +1,6 @@ package ch.epfl.maze.physical.stragegies.reducer; -import ch.epfl.maze.physical.World; +import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.util.Direction; import java.util.Set; @@ -13,7 +13,7 @@ import java.util.Set; public interface BlindChoiceReducer extends ChoiceReducer { @Override - default Set reduce(Set choices, World world) { + default Set reduce(Set choices, Daedalus daedalus) { return this.reduce(choices); } diff --git a/src/ch/epfl/maze/physical/stragegies/reducer/CaseReducer.java b/src/ch/epfl/maze/physical/stragegies/reducer/CaseReducer.java index 837bd4b..71de287 100644 --- a/src/ch/epfl/maze/physical/stragegies/reducer/CaseReducer.java +++ b/src/ch/epfl/maze/physical/stragegies/reducer/CaseReducer.java @@ -1,6 +1,6 @@ package ch.epfl.maze.physical.stragegies.reducer; -import ch.epfl.maze.physical.World; +import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.util.Direction; import java.util.Set; @@ -16,17 +16,17 @@ public interface CaseReducer extends ChoiceReducer { /** * Checks if the given choice should be kept or excluded by the filter. * - * @param choice A Direction - * @param world The World + * @param choice A Direction + * @param daedalus The Daedalus * @return T(The filter should keep the given choice) */ - boolean keepChoice(Direction choice, World world); + boolean keepChoice(Direction choice, Daedalus daedalus); @Override - default Set reduce(Set choices, World world) { + default Set reduce(Set choices, Daedalus daedalus) { return choices .stream() - .filter(choice -> this.keepChoice(choice, world)) + .filter(choice -> this.keepChoice(choice, daedalus)) .collect(Collectors.toSet()); } diff --git a/src/ch/epfl/maze/physical/stragegies/reducer/ChoiceReducer.java b/src/ch/epfl/maze/physical/stragegies/reducer/ChoiceReducer.java index 3cb744d..c7e8833 100644 --- a/src/ch/epfl/maze/physical/stragegies/reducer/ChoiceReducer.java +++ b/src/ch/epfl/maze/physical/stragegies/reducer/ChoiceReducer.java @@ -1,8 +1,7 @@ package ch.epfl.maze.physical.stragegies.reducer; -import ch.epfl.maze.physical.World; +import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.util.Direction; -import ch.epfl.maze.util.Vector2D; import java.util.Set; @@ -26,9 +25,10 @@ public interface ChoiceReducer { * In this variation, the animal knows the world entirely. It can therefore * use the position of other animals in the world to move more effectively. * - * @param choices The choices left to the animal + * @param choices The choices left to the animal + * @param daedalus The daedalus in which the animal moves * @return A subset of possible direction of the animal, chosen in {@code choices} */ - Set reduce(Set choices, World world); + Set reduce(Set choices, Daedalus daedalus); } -- cgit v1.2.3