/* author D3Q; june 2009, Uml2JavaMapper, version=0.31 This software is released under the Eclipse Public Licence for the text of the licence see: http://www.eclipse.org/legal/epl-v10.html */ package astar; import base; public class: AStar{ private PathNodeSet open; private PathNodeSet closed; public IMapPathNodes[1] map; public AStar(IMapPathNodes map) { self.map=map; } public base.Real heuristic(PathNode node); public PathNodeList findPath() { var startN: PathNode, endNs: PathNodeSet, nextN: PathNode, adjNs: PathNodeSet startN=self.map.getStartNode(); endNs=self.map.getEndNodes(); self.open.add(startN); nextN=startN; while ( nextN;) { adjNs=self.map.getAdjacentNodes(nextN); adjNs.asSet().forEach({ (x: PathNode ) self.open.add(x);}); if ( endNs.inSet(nextN);) { return self.makePath(nextN); } else { self.closed.add(nextN); self.open.subtract(nextN); nextN=self.bestNextNode(self.open); }; }; } private PathNodeList makePath(PathNode node); private PathNode bestNextNode(PathNodeSet openSet) { } }