The Analyzer class describes searching constraints for the Astar class.
Analyzers can be linked together using the Astar.addAnalyzer. You can create your own Analyzer by extending the Analyzer class
and overriding the Analyzer.analyzeTile and Analyzer.analyze methods.
protected var _subAnalyzer:Analyzerpublic function Analyzer() protected function analyze(mainTile:IAstarTile, allNeighbours:Vector.<IAstarTile>, neighboursLeft:Vector.<IAstarTile>, request:PathRequest):Vector.<IAstarTile>
Eliminates neighbours from the given array and returns the neighbours that were valid.
Parameters
| mainTile:IAstarTile — The tile who's neighbours are passed
|
| |
| allNeighbours:Vector.<IAstarTile> — A list consisting of all the neighbours, including those that were removed by other analyzers
|
| |
| neighboursLeft:Vector.<IAstarTile> — A list consisting of all the neighbours that have passed all the other analyzers. This is the list that should be modified and returned.
|
| |
| request:PathRequest — The PathRequest that is currently being executed
|
Returns | Vector.<IAstarTile> — A list consisting of all the neighbours that passed this analyzer
|
public function analyzeTile(mainTile:IAstarTile, req:PathRequest):Boolean
Used to validate a single tile. This method is used to see if the start/end tile is a valid tile.
Parameters
| mainTile:IAstarTile — The tile that is being analyzed
|
| |
| req:PathRequest — The path request that is currently being executed
|
Returns | Boolean — A boolean indicating whether or not the tile is valid
|
protected final function getSubAnalyzer():AnalyzerReturns public final function removeAnalyzer(toRemove:Analyzer):Analyzer
Removes an analyzer from the chain. If this isn't the analyzer that has to be removed, it is passed along the chain.
Parameters
Returns | Analyzer — Analyzer The sub analyzer of the analyzer that is removed. This is used to maintain the chain property
|
public final function setSubAnalyzer(subAnalyzer:Analyzer):void
Chains the given subAnalyzer to this analyzer
Parameters
| subAnalyzer:Analyzer — The subAnalyzer to chain to this analyzer
|
public final function subAnalyze(mainTile:DataTile, allNeighbours:Vector.<IAstarTile>, neighboursLeft:Vector.<IAstarTile>, req:PathRequest):Vector.<IAstarTile>
Manages the propper chaining of the subanalyzers. Backups are created, the DataTiles are converted to their containing tile, analyzed and converted back to DataTiles.
Parameters
| mainTile:DataTile — The tile who's neighbours are being analyzed
|
| |
| allNeighbours:Vector.<IAstarTile> — A list containing all the neighbours of the mainTile
|
| |
| neighboursLeft:Vector.<IAstarTile> — A list containing the neighbours of the mainTile that have passed the other analyzers up untill now
|
| |
| req:PathRequest — The PathRequest that is currently being executed
|
Returns | Vector.<IAstarTile> — A list with the tiles that have passed this analyzer
|
public final function subAnalyzeTile(mainTile:IAstarTile, req:PathRequest):Boolean
Analyzes if a single tile is valid. Used for start and end point
Parameters
| mainTile:IAstarTile — The tile that is being analyzed
|
| |
| req:PathRequest — The path request that is currently being executed
|
Returns | Boolean — A boolean indicating whether or not the tile is valid
|
Tue Oct 4 2011, 02:13 AM +02:00