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