|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrlgamekit.pathfinding.Path
public class Path
A breadth-first pathfinder, searching the shortest path from a start coordinate to a destination condistion. A path consists of discrete steps from one location to another. This pathfinding implementation is not reentrant, so each thread needs it's own instance of a path for pathfinding.
| Nested Class Summary | |
|---|---|
class |
Path.Node
One step of the path. |
| Constructor Summary | |
|---|---|
Path()
Creates a new instance of Path with no nodes. |
|
| Method Summary | |
|---|---|
void |
addStep(int x,
int y)
Add a step to this path |
void |
advance()
Advance current step by one. |
void |
clear()
Reset path, remove all nodes. |
Path.Node |
currentStep()
Retrieve current step. path.getCurrentStep() is equivalent to path.getStep(path.getCurrentIndex()); |
boolean |
findPath(PathSource pathSource,
PathDestination pathDestination,
int sx,
int sy)
Breadth first pathfinding. |
int |
getCurrentStepIndex()
Retrieve the current index on the path. path.getCurrentStep() is equivalent to path.getStep(path.getCurrentIndex()); |
Path.Node |
getStep(int n)
Random access for a step |
int |
length()
|
Path.Node |
nextStep()
Look ahead on next step |
void |
setUseDiagonals(boolean yesno)
Use diagonals in pathfinding? |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Path()
| Method Detail |
|---|
public void setUseDiagonals(boolean yesno)
public int length()
public Path.Node nextStep()
public int getCurrentStepIndex()
public Path.Node currentStep()
public Path.Node getStep(int n)
public void advance()
public void addStep(int x,
int y)
public void clear()
public boolean findPath(PathSource pathSource,
PathDestination pathDestination,
int sx,
int sy)
pathSource - the pathSource to searchpathDestination - to check weather a pathfinding step
reachded the destination.sx - Source x-coordinatesy - Source y-coordinate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||