Class ClingerRobot

java.lang.Object
  extended by java.lang.Thread
      extended by objectdraw.ActiveObject
          extended by Robot
              extended by ClingerRobot
All Implemented Interfaces:
Runnable

public class ClingerRobot
extends Robot

ClingerRobot moves around its rectangle. When it hits an obstacle it backs off to its previous position Then it tries to slide along the obstacle

Version:
2x06
Author:
Rhys Price Jones

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  boolean clinging
           
(package private)  Obstacle clungTo
           
(package private)  Obstacle previouslyClung
           
 
Fields inherited from class Robot
mycanvas, myImage, myVimage, obstacles, PAUSETIME, SIZE, xSpeed, ySpeed
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClingerRobot(Image me, objectdraw.DrawingCanvas canvas, objectdraw.Location point, Vector<Obstacle> obstacles)
          Constructor for objects of class ClingerRobot like all Robots, just calls parent constructor and starts
 
Method Summary
 void handleObstacles(objectdraw.Location lastLoc)
          handleObstacles what to do if we hit one of the obstacles
 void slide(Obstacle o)
           
 void unslide(Obstacle o)
           
 
Methods inherited from class Robot
run, setSpeed, step
 
Methods inherited from class objectdraw.ActiveObject
defer, getTime, pause, pause, pause, yield
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clinging

boolean clinging

clungTo

Obstacle clungTo

previouslyClung

Obstacle previouslyClung
Constructor Detail

ClingerRobot

public ClingerRobot(Image me,
                    objectdraw.DrawingCanvas canvas,
                    objectdraw.Location point,
                    Vector<Obstacle> obstacles)
Constructor for objects of class ClingerRobot like all Robots, just calls parent constructor and starts

Method Detail

handleObstacles

public void handleObstacles(objectdraw.Location lastLoc)
handleObstacles what to do if we hit one of the obstacles

Specified by:
handleObstacles in class Robot
Parameters:
lastLoc - -- the most recent good position I was in

slide

public void slide(Obstacle o)

unslide

public void unslide(Obstacle o)