rescuecore.sample
Class SampleSearch

java.lang.Object
  extended byrescuecore.sample.SampleSearch

public class SampleSearch
extends java.lang.Object


Constructor Summary
SampleSearch()
           
 
Method Summary
static int[] breadthFirstSearch(RescueObject start, RescueObject goal, Memory memory)
          Do a breadth first search from one location to another
static void sortByDistance(java.util.List objects, RescueObject reference, Memory memory)
          Sort a list of RescueObjects by distance.
static void sortByDistance(RescueObject[] objects, RescueObject reference, Memory memory)
          Sort an array of RescueObjects by distance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleSearch

public SampleSearch()
Method Detail

breadthFirstSearch

public static int[] breadthFirstSearch(RescueObject start,
                                       RescueObject goal,
                                       Memory memory)
Do a breadth first search from one location to another

Parameters:
start - The location we start at
goal - The location we want to get to
memory - The memory of the agent doing the searching
Returns:
The path from start to goal, or null if no path can be found

sortByDistance

public static void sortByDistance(java.util.List objects,
                                  RescueObject reference,
                                  Memory memory)
Sort a list of RescueObjects by distance. This list will be sorted in place.

Parameters:
objects - The objects to be sorted. When the method returns this list will be sorted.
reference - The RescueObject to measure distances from
memory - The memory of the agent doing the sorting

sortByDistance

public static void sortByDistance(RescueObject[] objects,
                                  RescueObject reference,
                                  Memory memory)
Sort an array of RescueObjects by distance. This array will be sorted in place.

Parameters:
objects - The objects to be sorted. When the method returns this array will be sorted.
reference - The RescueObject to measure distances from
memory - The memory of the agent doing the sorting