int tmpdirection = 0;\r
boolean first = true;\r
while(!set) {\r
- int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks];\r
+ int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks + 1];\r
for(int i = 0; i < parents.length; i++) {\r
parents[i] = -1;\r
}\r
// Array parents records parent for a node in the BFS search\r
// Vector cuts specifies which nodes can not be the first one to access in this BFS\r
private boolean BFS(Node start, Node end, int[] parents, Vector cuts) {\r
+ int steps = 0;\r
Vector toaccess = new Vector();\r
toaccess.addElement(start);\r
while(toaccess.size() > 0) {\r
toaccess.removeElementAt(0);\r
if(access.getIndex() == end.getIndex()) {\r
// hit the end node\r
+ parents[parents.length - 1] = steps;\r
return true;\r
}\r
+ steps++;\r
Vector neighbours = access.getNeighbours();\r
for(int i = 0; i < neighbours.size(); i++) {\r
Node neighbour = (Node)neighbours.elementAt(i);\r
}\r
}\r
}\r
+ parents[parents.length - 1] = -1;\r
return false;\r
}\r
\r
int tmpdirection = 0;
boolean first = true;
while(!set) {
- int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks];
+ int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks + 1];
for(int i = 0; i < parents.length; i++) {
parents[i] = -1;
}
// Array parents records parent for a node in the BFS search
// Vector cuts specifies which nodes can not be the first one to access in this BFS
private boolean BFS(Node start, Node end, int[] parents, Vector cuts) {
+ int steps = 0;
Vector toaccess = new Vector();
toaccess.addElement(start);
while(toaccess.size() > 0) {
toaccess.removeElementAt(0);
if(access.getIndex() == end.getIndex()) {
// hit the end node
+ parents[parents.length - 1] = steps;
return true;
}
+ steps++;
Vector neighbours = access.getNeighbours();
for(int i = 0; i < neighbours.size(); i++) {
Node neighbour = (Node)neighbours.elementAt(i);
}
}
}
+ parents[parents.length - 1] = -1;
return false;
}