diff options
Diffstat (limited to 'src/ch/epfl/maze/simulation')
-rw-r--r-- | src/ch/epfl/maze/simulation/DaedalusSimulation.java | 6 | ||||
-rw-r--r-- | src/ch/epfl/maze/simulation/MazeSimulation.java | 4 | ||||
-rw-r--r-- | src/ch/epfl/maze/simulation/Simulation.java | 10 |
3 files changed, 3 insertions, 17 deletions
diff --git a/src/ch/epfl/maze/simulation/DaedalusSimulation.java b/src/ch/epfl/maze/simulation/DaedalusSimulation.java index 8b60b57..90ff4a7 100644 --- a/src/ch/epfl/maze/simulation/DaedalusSimulation.java +++ b/src/ch/epfl/maze/simulation/DaedalusSimulation.java | |||
@@ -13,7 +13,6 @@ import java.util.*; | |||
13 | * predator and prey in a Daedalus, as well as the animation by notifying | 13 | * predator and prey in a Daedalus, as well as the animation by notifying |
14 | * changes to it. The simulation finishes when every prey has been caught. | 14 | * changes to it. The simulation finishes when every prey has been caught. |
15 | */ | 15 | */ |
16 | |||
17 | public final class DaedalusSimulation implements Simulation { | 16 | public final class DaedalusSimulation implements Simulation { |
18 | 17 | ||
19 | /* limit to the step counter, over which the animals are considered lost */ | 18 | /* limit to the step counter, over which the animals are considered lost */ |
@@ -33,7 +32,6 @@ public final class DaedalusSimulation implements Simulation { | |||
33 | * | 32 | * |
34 | * @param daedalus The daedalus to simulate | 33 | * @param daedalus The daedalus to simulate |
35 | */ | 34 | */ |
36 | |||
37 | public DaedalusSimulation(Daedalus daedalus) { | 35 | public DaedalusSimulation(Daedalus daedalus) { |
38 | mDaedalus = daedalus; | 36 | mDaedalus = daedalus; |
39 | mArrivalTimes = new TreeMap<Integer, List<Prey>>(Collections.reverseOrder()); | 37 | mArrivalTimes = new TreeMap<Integer, List<Prey>>(Collections.reverseOrder()); |
@@ -162,7 +160,6 @@ public final class DaedalusSimulation implements Simulation { | |||
162 | * @param listener The listener to which the function will notify the changes | 160 | * @param listener The listener to which the function will notify the changes |
163 | * (can be null) | 161 | * (can be null) |
164 | */ | 162 | */ |
165 | |||
166 | private void movePredators(Animation listener) { | 163 | private void movePredators(Animation listener) { |
167 | List<Predator> predators = mDaedalus.getPredators(); | 164 | List<Predator> predators = mDaedalus.getPredators(); |
168 | for (int i = 0; i < predators.size(); i++) { | 165 | for (int i = 0; i < predators.size(); i++) { |
@@ -231,7 +228,6 @@ public final class DaedalusSimulation implements Simulation { | |||
231 | * @param listener The listener to which the function will notify the changes | 228 | * @param listener The listener to which the function will notify the changes |
232 | * (can be null) | 229 | * (can be null) |
233 | */ | 230 | */ |
234 | |||
235 | private void movePreys(Animation listener) { | 231 | private void movePreys(Animation listener) { |
236 | List<Prey> preys = mDaedalus.getPreys(); | 232 | List<Prey> preys = mDaedalus.getPreys(); |
237 | Action action; | 233 | Action action; |
@@ -303,7 +299,6 @@ public final class DaedalusSimulation implements Simulation { | |||
303 | * @param listener The listener to which the function will notify the changes | 299 | * @param listener The listener to which the function will notify the changes |
304 | * (can be null) | 300 | * (can be null) |
305 | */ | 301 | */ |
306 | |||
307 | private void checkCollisions(Animation listener) { | 302 | private void checkCollisions(Animation listener) { |
308 | List<Predator> predators = mDaedalus.getPredators(); | 303 | List<Predator> predators = mDaedalus.getPredators(); |
309 | List<Prey> preys = mDaedalus.getPreys(); | 304 | List<Prey> preys = mDaedalus.getPreys(); |
@@ -346,4 +341,5 @@ public final class DaedalusSimulation implements Simulation { | |||
346 | } | 341 | } |
347 | } | 342 | } |
348 | } | 343 | } |
344 | |||
349 | } | 345 | } |
diff --git a/src/ch/epfl/maze/simulation/MazeSimulation.java b/src/ch/epfl/maze/simulation/MazeSimulation.java index 3fd0e52..2108f54 100644 --- a/src/ch/epfl/maze/simulation/MazeSimulation.java +++ b/src/ch/epfl/maze/simulation/MazeSimulation.java | |||
@@ -18,7 +18,6 @@ import java.util.TreeMap; | |||
18 | * the animation by notifying the changes to it. The simulation finishes when | 18 | * the animation by notifying the changes to it. The simulation finishes when |
19 | * every animal has found the exit. | 19 | * every animal has found the exit. |
20 | */ | 20 | */ |
21 | |||
22 | public final class MazeSimulation implements Simulation { | 21 | public final class MazeSimulation implements Simulation { |
23 | 22 | ||
24 | /* limit to the step counter, over which the animals are considered lost */ | 23 | /* limit to the step counter, over which the animals are considered lost */ |
@@ -34,7 +33,6 @@ public final class MazeSimulation implements Simulation { | |||
34 | * | 33 | * |
35 | * @param maze The maze to simulate | 34 | * @param maze The maze to simulate |
36 | */ | 35 | */ |
37 | |||
38 | public MazeSimulation(Maze maze) { | 36 | public MazeSimulation(Maze maze) { |
39 | mMaze = maze; | 37 | mMaze = maze; |
40 | mArrivalTimes = new TreeMap<Integer, List<Animal>>(); | 38 | mArrivalTimes = new TreeMap<Integer, List<Animal>>(); |
@@ -140,7 +138,6 @@ public final class MazeSimulation implements Simulation { | |||
140 | * @param listener The listener to which the function will notify the changes | 138 | * @param listener The listener to which the function will notify the changes |
141 | * (can be null) | 139 | * (can be null) |
142 | */ | 140 | */ |
143 | |||
144 | private void moveAnimals(Animation listener) { | 141 | private void moveAnimals(Animation listener) { |
145 | List<Animal> animals = mMaze.getAnimals(); | 142 | List<Animal> animals = mMaze.getAnimals(); |
146 | for (int i = 0; i < animals.size(); i++) { | 143 | for (int i = 0; i < animals.size(); i++) { |
@@ -205,4 +202,5 @@ public final class MazeSimulation implements Simulation { | |||
205 | } | 202 | } |
206 | } | 203 | } |
207 | } | 204 | } |
205 | |||
208 | } | 206 | } |
diff --git a/src/ch/epfl/maze/simulation/Simulation.java b/src/ch/epfl/maze/simulation/Simulation.java index ab2fb84..d373d2f 100644 --- a/src/ch/epfl/maze/simulation/Simulation.java +++ b/src/ch/epfl/maze/simulation/Simulation.java | |||
@@ -11,7 +11,6 @@ import java.util.Map; | |||
11 | * The {@code Simulation} interface defines a set of rules that must be | 11 | * The {@code Simulation} interface defines a set of rules that must be |
12 | * fulfilled in order to be displayed. | 12 | * fulfilled in order to be displayed. |
13 | */ | 13 | */ |
14 | |||
15 | public interface Simulation { | 14 | public interface Simulation { |
16 | 15 | ||
17 | /** | 16 | /** |
@@ -21,7 +20,6 @@ public interface Simulation { | |||
21 | * @param listener The listener to which the function will notify the changes | 20 | * @param listener The listener to which the function will notify the changes |
22 | * (can be null) | 21 | * (can be null) |
23 | */ | 22 | */ |
24 | |||
25 | public void move(Animation listener); | 23 | public void move(Animation listener); |
26 | 24 | ||
27 | /** | 25 | /** |
@@ -29,7 +27,6 @@ public interface Simulation { | |||
29 | * | 27 | * |
30 | * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise | 28 | * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise |
31 | */ | 29 | */ |
32 | |||
33 | public boolean isOver(); | 30 | public boolean isOver(); |
34 | 31 | ||
35 | /** | 32 | /** |
@@ -37,7 +34,6 @@ public interface Simulation { | |||
37 | * | 34 | * |
38 | * @return The {@code World} that is being simulated | 35 | * @return The {@code World} that is being simulated |
39 | */ | 36 | */ |
40 | |||
41 | public World getWorld(); | 37 | public World getWorld(); |
42 | 38 | ||
43 | /** | 39 | /** |
@@ -45,7 +41,6 @@ public interface Simulation { | |||
45 | * | 41 | * |
46 | * @return The current step counter | 42 | * @return The current step counter |
47 | */ | 43 | */ |
48 | |||
49 | public int getSteps(); | 44 | public int getSteps(); |
50 | 45 | ||
51 | /** | 46 | /** |
@@ -55,7 +50,6 @@ public interface Simulation { | |||
55 | * @return Map of steps done by animals which have accomplished the | 50 | * @return Map of steps done by animals which have accomplished the |
56 | * simulation | 51 | * simulation |
57 | */ | 52 | */ |
58 | |||
59 | public Map<Integer, List<Animal>> getArrivalTimes(); | 53 | public Map<Integer, List<Animal>> getArrivalTimes(); |
60 | 54 | ||
61 | /** | 55 | /** |
@@ -65,18 +59,16 @@ public interface Simulation { | |||
65 | * @return A {@code String} containing the top 10 animals which have | 59 | * @return A {@code String} containing the top 10 animals which have |
66 | * accomplished the simulation | 60 | * accomplished the simulation |
67 | */ | 61 | */ |
68 | |||
69 | public String getRecordTable(); | 62 | public String getRecordTable(); |
70 | 63 | ||
71 | /** | 64 | /** |
72 | * Restarts the simulation from the beginning. | 65 | * Restarts the simulation from the beginning. |
73 | */ | 66 | */ |
74 | |||
75 | public void restart(); | 67 | public void restart(); |
76 | 68 | ||
77 | /** | 69 | /** |
78 | * Stops abruptly the simulation. | 70 | * Stops abruptly the simulation. |
79 | */ | 71 | */ |
80 | |||
81 | public void stop(); | 72 | public void stop(); |
73 | |||
82 | } | 74 | } |