Class MoveTracker

java.lang.Object
  |
  +--MoveTracker

public class MoveTracker
extends java.lang.Object

The MoveTracker class is a data structure that contains a dynamic list of the moves a robot has made.


Constructor Summary
MoveTracker()
          Initializes the moveTracker Vector
 
Method Summary
 void add(Move mv)
          Adds the inputed move to the moveTracker Vector.
 void clear()
          Resets the moveTracker to an empty value.
 Move[] getMoveTracker()
          Returns an array of the moves within the moveTracker Vector
 boolean isEmpty()
          Checks to see if the moveTracker Vector is empty or not
 Move lastElement()
          Returns the last move in the moveTracker Vector
 Move removeLast()
          Removes the last move from the moveTracker Vector and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveTracker

public MoveTracker()
Initializes the moveTracker Vector
Method Detail

isEmpty

public boolean isEmpty()
Checks to see if the moveTracker Vector is empty or not
Returns:
Returns true if moveTracker is empty and false if not

clear

public void clear()
Resets the moveTracker to an empty value.
Precondition: None
Postcondition: The moveTracker vector is set to empty

add

public void add(Move mv)
Adds the inputed move to the moveTracker Vector.
Parameters:
mv - The move to be added to the vector
Precondition: None
Postcondition: The move was added to the moveTracer Vector

removeLast

public Move removeLast()
Removes the last move from the moveTracker Vector and returns it.
Returns:
Returns the move that was removed or null if the moveTracker is empty
Precondition: There needs to be a move on the moveTracker vector
Postcondition: The move was removed from the vector

lastElement

public Move lastElement()
Returns the last move in the moveTracker Vector
Returns:
Returns the last move in the moveTracker or null if the moveTracker is empty

getMoveTracker

public Move[] getMoveTracker()
Returns an array of the moves within the moveTracker Vector
Returns:
an array of Move
Precondition: moveTracker is not empty
Postcondition: an array of Move is returned