Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package model;
import java.util.ArrayList;
import java.util.List;
import util.Position;
public class Square {
private List<Entity> entities;
private Position position;
public Square(Position position){
this.entities = new ArrayList<Entity>();
this.entities.add(new EmptySquare(position));
this.position = position;
}
public Square(Position position, Entity entity){
this.entities = new ArrayList<Entity>();
this.entities.add(entity);
this.position = position;
}
public List<Entity> getEntities(){
return this.entities;
}
public Position getPosition(){
return this.position;
}
public void addEntity(Entity entity){
entities.add(entity);
}
public void removeEntity(Entity entity){
entities.remove(entity);
}
public void setEntities(List<Entity> entities){
this.entities = entities;
}
}