Repository navigation
Expand file tree
/
Copy pathWorld.java
More file actions
84 lines (72 loc) · 1.57 KB
/
Copy pathWorld.java
File metadata and controls
84 lines (72 loc) · 1.57 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package planner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.PriorityQueue;
import planner.Planner.Movement;
/*
* Representation of the blockWorld
*/
public class World {
public enum Block {
TRIANGLE,SQUARE,CIRCLE,BOX,RECTANGLE,NONE
}
private int armX,armY;
private Block load;
private ArrayList<ArrayList<Block>> world;
private PriorityQueue<Movement> plan;
/*
* Constructor for the blockWorld
*/
public World(int armX, int armY, Block load,
ArrayList<ArrayList<Block>> world) {
super();
this.armX = armX;
this.armY = armY;
this.load = load;
ArrayList<ArrayList<Block>> auxWorld = new ArrayList<ArrayList<Block>>();
auxWorld.addAll(world);
this.world = auxWorld;
this.plan = new PriorityQueue<Movement>();
}
public void addMovement(Movement movement) {
this.plan.add(movement);
}
public PriorityQueue<Movement> getPlan() {
return plan;
}
public void setPlan(PriorityQueue<Movement> plan) {
this.plan = plan;
}
public int getArmX() {
return armX;
}
public void setArmX(int armX) {
this.armX = armX;
}
public int getArmY() {
return armY;
}
public void setArmY(int armY) {
this.armY = armY;
}
public int isLoading() {
switch (this.load) {
case NONE:
return 0;
default:
return 1;
}
}
public Block getLoad() {
return this.load;
}
public void setLoad(Block block) {
this.load = block;
}
public ArrayList<ArrayList<Block>> getWorld() { //Modify to return a new one
return world;
}
public void setWorld(ArrayList<ArrayList<Block>> world) {
this.world = world;
}
}