summaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-11-24 15:03:04 +0100
committerPacien TRAN-GIRARD2015-11-24 15:08:29 +0100
commitbda6db0eb45b4fb10d9644d9b7bf2699e17a0e5d (patch)
tree3b362344ad734a1542d1a07348bd7463ebcbb28e /src/ch
parent15ae5683367df9f32df301cfc66dcbe41d193208 (diff)
downloadmaze-solver-bda6db0eb45b4fb10d9644d9b7bf2699e17a0e5d.tar.gz
Keep method compatibility for tests
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/maze/physical/Animal.java9
-rw-r--r--src/ch/epfl/maze/physical/Predator.java9
-rw-r--r--src/ch/epfl/maze/physical/Prey.java9
-rw-r--r--src/ch/epfl/maze/tests/AnimalTest.java2
-rw-r--r--src/ch/epfl/maze/tests/GhostsTest.java2
5 files changed, 23 insertions, 8 deletions
diff --git a/src/ch/epfl/maze/physical/Animal.java b/src/ch/epfl/maze/physical/Animal.java
index 04c4baf..e15cb74 100644
--- a/src/ch/epfl/maze/physical/Animal.java
+++ b/src/ch/epfl/maze/physical/Animal.java
@@ -47,8 +47,11 @@ abstract public class Animal {
47 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) 47 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D)
48 * World.getChoices(Vector2D)}) 48 * World.getChoices(Vector2D)})
49 * @return The next direction of the animal, chosen in {@code choices} 49 * @return The next direction of the animal, chosen in {@code choices}
50 * @implNote Not abstract for compatibility purpose (in order not to break tests)
50 */ 51 */
51 abstract public Direction move(Set<Direction> choices); 52 public Direction move(Set<Direction> choices) {
53 return null;
54 }
52 55
53 /** 56 /**
54 * Retrieves the next direction of the animal, by selecting one choice among 57 * Retrieves the next direction of the animal, by selecting one choice among
@@ -58,8 +61,10 @@ abstract public class Animal {
58 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) 61 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D)
59 * World.getChoices(Vector2D)}) 62 * World.getChoices(Vector2D)})
60 * @return The next direction of the animal, chosen in {@code choices} 63 * @return The next direction of the animal, chosen in {@code choices}
64 * @apiNote Not final for compatibility purpose (in order not to break tests)
65 * @deprecated Use @code{Direction move(Set<Direction> choices)} instead
61 */ 66 */
62 public final Direction move(Direction[] choices) { 67 public Direction move(Direction[] choices) {
63 return this.move(EnumSet.copyOf(Arrays.asList(choices))); 68 return this.move(EnumSet.copyOf(Arrays.asList(choices)));
64 } 69 }
65 70
diff --git a/src/ch/epfl/maze/physical/Predator.java b/src/ch/epfl/maze/physical/Predator.java
index 5f0a3bb..ad5900e 100644
--- a/src/ch/epfl/maze/physical/Predator.java
+++ b/src/ch/epfl/maze/physical/Predator.java
@@ -37,8 +37,11 @@ abstract public class Predator extends ProbabilisticAnimal {
37 * World.getChoices(Vector2D)}) 37 * World.getChoices(Vector2D)})
38 * @param daedalus The world in which the animal moves 38 * @param daedalus The world in which the animal moves
39 * @return The next direction of the animal, chosen in {@code choices} 39 * @return The next direction of the animal, chosen in {@code choices}
40 * @implNote Not abstract for compatibility purpose (in order not to break tests)
40 */ 41 */
41 abstract public Direction move(Set<Direction> choices, Daedalus daedalus); 42 public Direction move(Set<Direction> choices, Daedalus daedalus) {
43 return null;
44 }
42 45
43 /** 46 /**
44 * Retrieves the next direction of the animal, by selecting one choice among 47 * Retrieves the next direction of the animal, by selecting one choice among
@@ -53,8 +56,10 @@ abstract public class Predator extends ProbabilisticAnimal {
53 * World.getChoices(Vector2D)}) 56 * World.getChoices(Vector2D)})
54 * @param daedalus The world in which the animal moves 57 * @param daedalus The world in which the animal moves
55 * @return The next direction of the animal, chosen in {@code choices} 58 * @return The next direction of the animal, chosen in {@code choices}
59 * @apiNote Not final for compatibility purpose (in order not to break tests)
60 * @deprecated Use @code{Direction move(Set<Direction> choices, Daedalus daedalus)} instead
56 */ 61 */
57 public final Direction move(Direction[] choices, Daedalus daedalus) { 62 public Direction move(Direction[] choices, Daedalus daedalus) {
58 return this.move(EnumSet.copyOf(Arrays.asList(choices)), daedalus); 63 return this.move(EnumSet.copyOf(Arrays.asList(choices)), daedalus);
59 } 64 }
60 65
diff --git a/src/ch/epfl/maze/physical/Prey.java b/src/ch/epfl/maze/physical/Prey.java
index 3654807..ff760c5 100644
--- a/src/ch/epfl/maze/physical/Prey.java
+++ b/src/ch/epfl/maze/physical/Prey.java
@@ -37,8 +37,11 @@ abstract public class Prey extends ProbabilisticAnimal {
37 * World.getChoices(Vector2D)}) 37 * World.getChoices(Vector2D)})
38 * @param daedalus The world in which the animal moves 38 * @param daedalus The world in which the animal moves
39 * @return The next direction of the animal, chosen in {@code choices} 39 * @return The next direction of the animal, chosen in {@code choices}
40 * @implNote Not abstract for compatibility purpose (in order not to break tests)
40 */ 41 */
41 abstract public Direction move(Set<Direction> choices, Daedalus daedalus); 42 public Direction move(Set<Direction> choices, Daedalus daedalus) {
43 return null;
44 }
42 45
43 /** 46 /**
44 * Retrieves the next direction of the animal, by selecting one choice among 47 * Retrieves the next direction of the animal, by selecting one choice among
@@ -53,8 +56,10 @@ abstract public class Prey extends ProbabilisticAnimal {
53 * World.getChoices(Vector2D)}) 56 * World.getChoices(Vector2D)})
54 * @param daedalus The world in which the animal moves 57 * @param daedalus The world in which the animal moves
55 * @return The next direction of the animal, chosen in {@code choices} 58 * @return The next direction of the animal, chosen in {@code choices}
59 * @apiNote Not final for compatibility purpose (in order not to break tests)
60 * @deprecated Use @code{Direction move(Set<Direction> choices, Daedalus daedalus)} instead
56 */ 61 */
57 public final Direction move(Direction[] choices, Daedalus daedalus) { 62 public Direction move(Direction[] choices, Daedalus daedalus) {
58 return this.move(EnumSet.copyOf(Arrays.asList(choices)), daedalus); 63 return this.move(EnumSet.copyOf(Arrays.asList(choices)), daedalus);
59 } 64 }
60 65
diff --git a/src/ch/epfl/maze/tests/AnimalTest.java b/src/ch/epfl/maze/tests/AnimalTest.java
index 0b02442..1fd8943 100644
--- a/src/ch/epfl/maze/tests/AnimalTest.java
+++ b/src/ch/epfl/maze/tests/AnimalTest.java
@@ -79,7 +79,7 @@ public class AnimalTest extends TestCase {
79 } 79 }
80 80
81 @Override 81 @Override
82 public Direction move(Set<Direction> choices) { 82 public Direction move(Direction[] choices) {
83 return null; 83 return null;
84 } 84 }
85 85
diff --git a/src/ch/epfl/maze/tests/GhostsTest.java b/src/ch/epfl/maze/tests/GhostsTest.java
index c6970b1..35dddbf 100644
--- a/src/ch/epfl/maze/tests/GhostsTest.java
+++ b/src/ch/epfl/maze/tests/GhostsTest.java
@@ -128,7 +128,7 @@ public class GhostsTest extends TestCase {
128 } 128 }
129 129
130 @Override 130 @Override
131 public Direction move(Set<Direction> choices, Daedalus daedalus) { 131 public Direction move(Direction[] choices, Daedalus daedalus) {
132 if (mMoves) { 132 if (mMoves) {
133 return getPosition().getX() % 2 == 0 ? Direction.RIGHT : Direction.LEFT; 133 return getPosition().getX() % 2 == 0 ? Direction.RIGHT : Direction.LEFT;
134 } 134 }