com.ebmwebsourcing.geasytools.geasygraph.impl.alphastar
Class AlphaStarPathFinder

java.lang.Object
  extended by com.ebmwebsourcing.geasytools.geasygraph.impl.PathFinder
      extended by com.ebmwebsourcing.geasytools.geasygraph.impl.alphastar.AlphaStarPathFinder
All Implemented Interfaces:
IAlphaStarPathFinder, IPathFinder

public class AlphaStarPathFinder
extends PathFinder
implements IAlphaStarPathFinder

Based on resource found at: http://www.policyalmanac.org/games/aStarTutorial.htm

Author:
nfleury

Constructor Summary
AlphaStarPathFinder(IGraph graph, INode source, INode target)
           
 
Method Summary
 void addNodeToClosedList(IAlphaNode node)
           
 void addNodeToOpenseList(IAlphaNode node)
           
 java.util.LinkedHashSet<IAlphaNode> getClosedList()
           
 double getGCost(IAlphaNode node1, IAlphaNode node2)
           
 double getHCost(IAlphaNode node)
          Manhattan (only orthogonal movements) distance between a node and the target destination
 IAlphaNode getLowestCostNode()
          Gets lowest cost node in open list
 java.util.LinkedHashSet<IAlphaNode> getOpenList()
           
 java.util.LinkedHashSet<INode> getShortestPath()
           
 boolean nodesAreOthogonal(INode node1, INode node2)
           
 
Methods inherited from class com.ebmwebsourcing.geasytools.geasygraph.impl.PathFinder
addNonWalkableNode, getGraph, getNonWalkableNodes, getSource, getTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ebmwebsourcing.geasytools.geasygraph.api.IPathFinder
addNonWalkableNode, getGraph, getNonWalkableNodes, getSource, getTarget
 

Constructor Detail

AlphaStarPathFinder

public AlphaStarPathFinder(IGraph graph,
                           INode source,
                           INode target)
Method Detail

getLowestCostNode

public IAlphaNode getLowestCostNode()
Gets lowest cost node in open list

Specified by:
getLowestCostNode in interface IAlphaStarPathFinder
Returns:

getShortestPath

public java.util.LinkedHashSet<INode> getShortestPath()
Specified by:
getShortestPath in interface IPathFinder
Specified by:
getShortestPath in class PathFinder

getGCost

public double getGCost(IAlphaNode node1,
                       IAlphaNode node2)

getHCost

public double getHCost(IAlphaNode node)
Manhattan (only orthogonal movements) distance between a node and the target destination

Parameters:
node -
Returns:

nodesAreOthogonal

public boolean nodesAreOthogonal(INode node1,
                                 INode node2)

addNodeToOpenseList

public void addNodeToOpenseList(IAlphaNode node)
Specified by:
addNodeToOpenseList in interface IAlphaStarPathFinder

addNodeToClosedList

public void addNodeToClosedList(IAlphaNode node)
Specified by:
addNodeToClosedList in interface IAlphaStarPathFinder

getOpenList

public java.util.LinkedHashSet<IAlphaNode> getOpenList()
Specified by:
getOpenList in interface IAlphaStarPathFinder

getClosedList

public java.util.LinkedHashSet<IAlphaNode> getClosedList()
Specified by:
getClosedList in interface IAlphaStarPathFinder


Copyright © 2010-2011 Petals Link. All Rights Reserved.