AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.graph.IGraphSearch Interface Reference
Inheritance diagram for game2dai.graph.IGraphSearch:

Public Member Functions

LinkedList< GraphNodesearch (int startID, int targetID)
 
LinkedList< GraphNodesearch (int startID, int targetID, boolean remember)
 
GraphEdge[] getExaminedEdges ()
 
public< T > T[] getExaminedEdges (T[] array)
 
GraphNode[] getRoute ()
 
public< T > T[] getRoute (T[] array)
 

Detailed Description

Any class that can be used to search the graph should implement this class.

Author
Peter Lager

Member Function Documentation

◆ getExaminedEdges() [1/2]

GraphEdge[] game2dai.graph.IGraphSearch.getExaminedEdges ( )

Get all the edges examined during the search.

Returns
edges examined or array size 0 if none found

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.

◆ getExaminedEdges() [2/2]

public< T > T[] game2dai.graph.IGraphSearch.getExaminedEdges ( T[]  array)

Get all the edges examined during the search.
The type of each element in the array will be of type Object if the parameter is null otherwise it is T (where T is GraphEdge or any class that extends GraphEdge.

Parameters
arraythe array to populate
Returns
edges examined or array size 0 if none found

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.

◆ getRoute() [1/2]

GraphNode[] game2dai.graph.IGraphSearch.getRoute ( )

Get the path found as an array of GraphNode(s) in start->end order

Returns
path found or array size 0 if none found

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.

◆ getRoute() [2/2]

public< T > T[] game2dai.graph.IGraphSearch.getRoute ( T[]  array)

Get the path found as an array of T(s) in start->end order.
The type of each element in the array will be of type Object if the parameter is null otherwise it is T (where T is GraphNode or any class that extends GraphNode.

Parameters
arraythe array to populate
Returns
path found or array size 0 if none found

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.

◆ search() [1/2]

LinkedList< GraphNode > game2dai.graph.IGraphSearch.search ( int  startID,
int  targetID 
)

Search for a route from node startID and ends at targetID.
This will return a linkedlist of the nodes that make up the route from start to end order.
If either the start or target node does not exist or if a route can't be found the returned list is empty.

Parameters
startIDid of the start node
targetIDid of the target node
Returns
the route as a list of nodes

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.

◆ search() [2/2]

LinkedList< GraphNode > game2dai.graph.IGraphSearch.search ( int  startID,
int  targetID,
boolean  remember 
)

Search for a route from node startID and ends at targetID.
This will return a linkedlist of the nodes that make up the route from start to end order.
If either the start or target node does not exist or if a route can't be found the returned list is empty.

Parameters
startIDid of the start node
targetIDid of the target node
rememberwhether to remember the examined edges.
Returns
the route as a list of nodes

Implemented in game2dai.graph.GraphSearch_Astar, game2dai.graph.GraphSearch_BFS, game2dai.graph.GraphSearch_DFS, and game2dai.graph.GraphSearch_Dijkstra.


The documentation for this interface was generated from the following file: