What's everyone's favourite kind of safety?
Type Safety!! git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@19 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -133,9 +133,9 @@ public class AStarPathUtil
|
||||
*
|
||||
* @return the list of points in the path.
|
||||
*/
|
||||
public static List getPath (TraversalPred tpred, Stepper stepper,
|
||||
Object trav, int longest, int ax, int ay,
|
||||
int bx, int by, boolean partial)
|
||||
public static List<Point> getPath (
|
||||
TraversalPred tpred, Stepper stepper, Object trav, int longest,
|
||||
int ax, int ay, int bx, int by, boolean partial)
|
||||
{
|
||||
Info info = new Info(tpred, trav, longest, bx, by);
|
||||
|
||||
@@ -193,7 +193,8 @@ public class AStarPathUtil
|
||||
* Gets a path with the default stepper which assumes the piece can
|
||||
* move one in any of the eight cardinal directions.
|
||||
*/
|
||||
public static List getPath (TraversalPred tpred, Object trav, int longest,
|
||||
public static List<Point> getPath (
|
||||
TraversalPred tpred, Object trav, int longest,
|
||||
int ax, int ay, int bx, int by, boolean partial)
|
||||
{
|
||||
return getPath(
|
||||
@@ -231,7 +232,7 @@ public class AStarPathUtil
|
||||
|
||||
// make sure the cost is reasonable
|
||||
if (newg > info.maxcost) {
|
||||
// Log.info("Rejected costly step.");
|
||||
// Log.info("Rejected costly step.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,10 +273,10 @@ public class AStarPathUtil
|
||||
*
|
||||
* @return the list detailing the path.
|
||||
*/
|
||||
protected static List getNodePath (Node n)
|
||||
protected static List<Point> getNodePath (Node n)
|
||||
{
|
||||
Node cur = n;
|
||||
ArrayList path = new ArrayList();
|
||||
ArrayList<Point> path = new ArrayList<Point>();
|
||||
|
||||
while (cur != null) {
|
||||
// add to the head of the list since we're traversing from
|
||||
@@ -318,10 +319,10 @@ public class AStarPathUtil
|
||||
public Object trav;
|
||||
|
||||
/** The set of open nodes being searched. */
|
||||
public SortedSet open;
|
||||
public SortedSet<Node> open;
|
||||
|
||||
/** The set of closed nodes being searched. */
|
||||
public ArrayList closed;
|
||||
public ArrayList<Node> closed;
|
||||
|
||||
/** The destination coordinates in the tile array. */
|
||||
public int destx, desty;
|
||||
@@ -342,8 +343,8 @@ public class AStarPathUtil
|
||||
this.maxcost = longest * ADJACENT_COST;
|
||||
|
||||
// construct the open and closed lists
|
||||
open = new TreeSet();
|
||||
closed = new ArrayList();
|
||||
open = new TreeSet<Node>();
|
||||
closed = new ArrayList<Node>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,7 +391,7 @@ public class AStarPathUtil
|
||||
// note: this _could_ break for unusual values of x and y.
|
||||
// perhaps use a IntTuple as a key? Bleah.
|
||||
int key = (x << 16) | (y & 0xffff);
|
||||
Node node = (Node) _nodes.get(key);
|
||||
Node node = _nodes.get(key);
|
||||
if (node == null) {
|
||||
node = new Node(x, y);
|
||||
_nodes.put(key, node);
|
||||
@@ -399,7 +400,7 @@ public class AStarPathUtil
|
||||
}
|
||||
|
||||
/** The nodes being considered in the path. */
|
||||
protected HashIntMap _nodes = new HashIntMap();
|
||||
protected HashIntMap<Node> _nodes = new HashIntMap<Node>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -294,7 +294,7 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
|
||||
// get a reasonable tile path through the scene
|
||||
long start = System.currentTimeMillis();
|
||||
List points = AStarPathUtil.getPath(
|
||||
List<Point> points = AStarPathUtil.getPath(
|
||||
this, sprite, longestPath, src.x, src.y, dest.x, dest.y, loose);
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user