summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical/World.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/maze/physical/World.java')
-rw-r--r--src/ch/epfl/maze/physical/World.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ch/epfl/maze/physical/World.java b/src/ch/epfl/maze/physical/World.java
index 7d33472..9730876 100644
--- a/src/ch/epfl/maze/physical/World.java
+++ b/src/ch/epfl/maze/physical/World.java
@@ -5,6 +5,7 @@ import ch.epfl.maze.util.Vector2D;
5 5
6import java.util.ArrayList; 6import java.util.ArrayList;
7import java.util.List; 7import java.util.List;
8import java.util.Set;
8 9
9/** 10/**
10 * World that is represented by a labyrinth of tiles in which an {@code Animal} 11 * World that is represented by a labyrinth of tiles in which an {@code Animal}
@@ -70,11 +71,24 @@ public abstract class World {
70 abstract public void reset(); 71 abstract public void reset();
71 72
72 /** 73 /**
74 * Returns a copy of the set of all current animals in the world.
75 *
76 * @return A set of all animals in the world
77 */
78 public Set<Animal> getAnimalSet() {
79 return null;
80 }
81
82 /**
73 * Returns a copy of the list of all current animals in the world. 83 * Returns a copy of the list of all current animals in the world.
74 * 84 *
75 * @return A list of all animals in the world 85 * @return A list of all animals in the world
86 * @implNote Not abstract for compatibility purpose (in order not to break tests)
87 * @deprecated Use getAnimalSet() instead
76 */ 88 */
77 abstract public List<Animal> getAnimals(); 89 public List<Animal> getAnimals() {
90 return new ArrayList<>(this.getAnimalSet());
91 }
78 92
79 /** 93 /**
80 * Checks in a safe way the tile number at position (x, y) in the labyrinth. 94 * Checks in a safe way the tile number at position (x, y) in the labyrinth.