summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/simulation/Simulation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/maze/simulation/Simulation.java')
-rw-r--r--src/ch/epfl/maze/simulation/Simulation.java108
1 files changed, 53 insertions, 55 deletions
diff --git a/src/ch/epfl/maze/simulation/Simulation.java b/src/ch/epfl/maze/simulation/Simulation.java
index c3190b3..ab2fb84 100644
--- a/src/ch/epfl/maze/simulation/Simulation.java
+++ b/src/ch/epfl/maze/simulation/Simulation.java
@@ -1,84 +1,82 @@
1package ch.epfl.maze.simulation; 1package ch.epfl.maze.simulation;
2 2
3import java.util.List;
4import java.util.Map;
5
6import ch.epfl.maze.graphics.Animation; 3import ch.epfl.maze.graphics.Animation;
7import ch.epfl.maze.physical.Animal; 4import ch.epfl.maze.physical.Animal;
8import ch.epfl.maze.physical.World; 5import ch.epfl.maze.physical.World;
9 6
7import java.util.List;
8import java.util.Map;
9
10/** 10/**
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 *
14 */ 13 */
15 14
16public interface Simulation { 15public interface Simulation {
17 16
18 /** 17 /**
19 * Asks the {@code Simulation} to compute the next move and, if specified, 18 * Asks the {@code Simulation} to compute the next move and, if specified,
20 * notifies the changes to the listener. 19 * notifies the changes to the listener.
21 * 20 *
22 * @param listener 21 * @param listener The listener to which the function will notify the changes
23 * The listener to which the function will notify the changes 22 * (can be null)
24 * (can be null) 23 */
25 */
26 24
27 public void move(Animation listener); 25 public void move(Animation listener);
28 26
29 /** 27 /**
30 * Determines if the simulation is over. 28 * Determines if the simulation is over.
31 * 29 *
32 * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise 30 * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise
33 */ 31 */
34 32
35 public boolean isOver(); 33 public boolean isOver();
36 34
37 /** 35 /**
38 * Retrieves the current state of the simulated world. 36 * Retrieves the current state of the simulated world.
39 * 37 *
40 * @return The {@code World} that is being simulated 38 * @return The {@code World} that is being simulated
41 */ 39 */
42 40
43 public World getWorld(); 41 public World getWorld();
44 42
45 /** 43 /**
46 * Retrieves the step counter of the {@code Simulation}. 44 * Retrieves the step counter of the {@code Simulation}.
47 * 45 *
48 * @return The current step counter 46 * @return The current step counter
49 */ 47 */
50 48
51 public int getSteps(); 49 public int getSteps();
52 50
53 /** 51 /**
54 * Retrieves the mapping of the steps done by the animals that have finished 52 * Retrieves the mapping of the steps done by the animals that have finished
55 * the simulation. 53 * the simulation.
56 * 54 *
57 * @return Map of steps done by animals which have accomplished the 55 * @return Map of steps done by animals which have accomplished the
58 * simulation 56 * simulation
59 */ 57 */
60 58
61 public Map<Integer, List<Animal>> getArrivalTimes(); 59 public Map<Integer, List<Animal>> getArrivalTimes();
62 60
63 /** 61 /**
64 * Retrieves the record table of the animals that have finished the 62 * Retrieves the record table of the animals that have finished the
65 * simulation. 63 * simulation.
66 * 64 *
67 * @return A {@code String} containing the top 10 animals which have 65 * @return A {@code String} containing the top 10 animals which have
68 * accomplished the simulation 66 * accomplished the simulation
69 */ 67 */
70 68
71 public String getRecordTable(); 69 public String getRecordTable();
72 70
73 /** 71 /**
74 * Restarts the simulation from the beginning. 72 * Restarts the simulation from the beginning.
75 */ 73 */
76 74
77 public void restart(); 75 public void restart();
78 76
79 /** 77 /**
80 * Stops abruptly the simulation. 78 * Stops abruptly the simulation.
81 */ 79 */
82 80
83 public void stop(); 81 public void stop();
84} 82}