edu.udo.cs.ie.cowbots.util
Class PathTransformer

Package class diagram package PathTransformer
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.util.PathTransformer

public class PathTransformer
extends java.lang.Object

auxiliary class that provide static methods to transcode a path on a gridmap between point based and textual direction based representation


Field Summary
(package private) static java.lang.String[][] pEnc
           
 
Constructor Summary
PathTransformer()
           
 
Method Summary
static int getDirectionX(java.lang.String dir)
          this method returns the x-component of a direction dir
static int getDirectionY(java.lang.String dir)
          this method returns the y-component of a direction dir
static java.lang.String getMove(java.awt.Point p0, java.awt.Point p1)
          returns the movement command equal to the direction represented by two points
static java.awt.Point getNextPoint(java.awt.Point p, java.lang.String dir)
          this method returns the next point from a starting point and an a* direction
static java.lang.String[] getPath(java.util.List<java.awt.Point> path)
          this method returns a path in string based representation from a path in point based representation
static java.util.List<java.awt.Point> getPathPoints(java.awt.Point start, java.lang.String[] astarpath)
          this method converts an astar path from a starting point into a list of points (absolute cell coordinates)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pEnc

static java.lang.String[][] pEnc
Constructor Detail

PathTransformer

public PathTransformer()
Method Detail

getDirectionX

public static int getDirectionX(java.lang.String dir)
this method returns the x-component of a direction dir

Parameters:
dir - a* direction
Returns:
-1,0 or 1

getDirectionY

public static int getDirectionY(java.lang.String dir)
this method returns the y-component of a direction dir

Parameters:
dir - a* direction
Returns:
-1,0 or 1

getNextPoint

public static java.awt.Point getNextPoint(java.awt.Point p,
                                          java.lang.String dir)
this method returns the next point from a starting point and an a* direction

Parameters:
p - starting point
dir - direction (north, northwest, etc..)
Returns:
point at p + dir

getPathPoints

public static java.util.List<java.awt.Point> getPathPoints(java.awt.Point start,
                                                           java.lang.String[] astarpath)
this method converts an astar path from a starting point into a list of points (absolute cell coordinates)

Parameters:
start - starting point
astarpath - a* caluclated path
Returns:
path as point-list represenation

getPath

public static java.lang.String[] getPath(java.util.List<java.awt.Point> path)
this method returns a path in string based representation from a path in point based representation

Parameters:
path - path in point representation
Returns:
path in string representation

getMove

public static java.lang.String getMove(java.awt.Point p0,
                                       java.awt.Point p1)
returns the movement command equal to the direction represented by two points

Parameters:
p0 - start point
p1 - end point
Returns:
a direction like north, east, southwest, or skip