1 package cz.cuni.amis.pogamut.ut2004.agent.navigation.astar;
2
3 import java.util.Set;
4
5 import cz.cuni.amis.pathfinding.alg.astar.AStar;
6 import cz.cuni.amis.pathfinding.alg.floydwarshall.FloydWarshall;
7 import cz.cuni.amis.pathfinding.map.IPFGoal;
8 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
9 import cz.cuni.amis.utils.heap.IHeap;
10
11
12
13
14
15
16
17
18 public abstract class UT2004PFTask implements IPFGoal<NavPoint> {
19
20 private IHeap<NavPoint> openList;
21 private Set<NavPoint> closedList;
22 private NavPoint startNode;
23
24 public UT2004PFTask(NavPoint startNode) {
25 this.startNode = startNode;
26 }
27
28 @Override
29 public void setOpenList(IHeap<NavPoint> openList) {
30 this.openList = openList;
31 }
32
33 @Override
34 public void setCloseList(Set<NavPoint> closedList) {
35 this.closedList = closedList;
36 }
37
38
39
40
41
42
43
44
45 public IHeap<NavPoint> getOpenList() {
46 return openList;
47 }
48
49
50
51
52
53
54 public Set<NavPoint> getClosedList() {
55 return closedList;
56 }
57
58 @Override
59 public NavPoint getStart() {
60 return startNode;
61 }
62
63 @Override
64 public abstract boolean isGoalReached(NavPoint actualNode);
65
66 @Override
67 public int getEstimatedCostToGoal(NavPoint node) {
68 if (node == null) return Integer.MAX_VALUE;
69 return (int)Math.round(startNode.getLocation().getDistance(node.getLocation()));
70 }
71
72 }