Class RoadPoints

java.lang.Object
  extended by SearchNode
      extended by RoadPoints

public class RoadPoints
extends SearchNode

RoadPoints.java Created: Mon Nov 29 21:50:36 2004


Field Summary
 
Fields inherited from class SearchNode
depth, parent
 
Constructor Summary
RoadPoints(int index)
          Creates a new RoadPoints instance.
 
Method Summary
 void addChild(RoadPoints child)
          addChild - this method adds a child to the children vector
 java.util.Vector expand()
          expand - method is used in the BreadthFirstSearcher to find the optimal path for the robot, it returns the children of the current road point
 int getIndex()
          getIndex - returns the index of the road point (this index is specified by the programmer in the Map class)
 boolean isConnected(RoadPoints point)
          isConnected - this method will return whether the current node is a parent of another node that is specified in the parameters of the method
 boolean isGoal()
          isGoal - returns a boolean value of whether this point is the goal or not
 void setGoal()
          setGoal - will change the isGoal boolean from false to true, making it the goal for the robot
 java.lang.String toString()
          toString - returns a string representation of the road point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoadPoints

public RoadPoints(int index)
Creates a new RoadPoints instance. When the roadPoint is initialized, it initializes the index to a given integer and initializes the vector of children (children will be entered later)

Parameters:
index - an int value - the index of the roadPoint
Method Detail

addChild

public void addChild(RoadPoints child)
addChild - this method adds a child to the children vector

Parameters:
child - a RoadPoints value - a RoadPoint this is connected to

setGoal

public void setGoal()
setGoal - will change the isGoal boolean from false to true, making it the goal for the robot


isConnected

public boolean isConnected(RoadPoints point)
isConnected - this method will return whether the current node is a parent of another node that is specified in the parameters of the method

Parameters:
point - a RoadPoints value - the child in question
Returns:
a boolean value - returns true if the two road points are connected, otherwise returns false

expand

public java.util.Vector expand()
expand - method is used in the BreadthFirstSearcher to find the optimal path for the robot, it returns the children of the current road point

Specified by:
expand in class SearchNode
Returns:
a Vector value - the children of the road point

isGoal

public boolean isGoal()
isGoal - returns a boolean value of whether this point is the goal or not

Specified by:
isGoal in class SearchNode
Returns:
a boolean value - returns true if this point is the goal, false otherwise

getIndex

public int getIndex()
getIndex - returns the index of the road point (this index is specified by the programmer in the Map class)

Returns:
an int value - returns the index of the road point

toString

public java.lang.String toString()
toString - returns a string representation of the road point. Since the point does not have too many variables, it simply returns the point's index as a string.

Overrides:
toString in class java.lang.Object
Returns:
a String value