dLife Home Page

dlife.robot
Class PseudoDevice

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.PseudoDevice
Direct Known Subclasses:
ConsoleSensor, TextStreamSensor, VideoDisplay

public abstract class PseudoDevice
extends Device

Abstract base class for devices that do not require communication with a robot. The difference between this class and the Device class is that a PseudoDevice makes no contact with the robot which it is applied to. All methods will require another means of communication to gather the required information. Examples of PseudoDevices might be an overhead camera to gather information on a robot, or the proximity of two StageRobots to each other in a Stage simulation.

Version:
June 1, 2010
Author:
Russell Toris, Dickinson College

Field Summary
 
Fields inherited from class dlife.robot.Device
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount
 
Constructor Summary
PseudoDevice(boolean autoRead)
          Construct a new PseudoDevice.
PseudoDevice(int readDelay, int guiDelay, boolean autoRead)
          Construct a new PseudoDevice.
 
Method Summary
 void freeze()
          Does nothing.
 Robot getRobot()
          Returns null.
abstract  void readStateFromPseudoDevice()
          Reads the state of the Pseudo device.
 void readStateFromRobot()
          This method just calls readStateFromPseudoDevice.
 void setRobot(Robot robot)
          This method does nothing.
 
Methods inherited from class dlife.robot.Device
createGUIObjects, getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getSensorReadCount, getSensorReadRate, setAutoRead, setGUIUpdateDelay, setReadDelay, shutDown, startAutoReadTimer, startUp, stopAutoReadTimer
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PseudoDevice

public PseudoDevice(boolean autoRead)
Construct a new PseudoDevice.

Parameters:
autoRead - true to ensure that the AutoReadTimer is started, false to ensure that it is not started.

PseudoDevice

public PseudoDevice(int readDelay,
                    int guiDelay,
                    boolean autoRead)
Construct a new PseudoDevice.

Parameters:
readDelay - the delay between calls to readStateFromRobot
guiDelay -
autoRead -
Method Detail

setRobot

public final void setRobot(Robot robot)
This method does nothing. A PseudoDevice should not speak with the robot. It should only gather information that does not come directly from the robot itself.

Overrides:
setRobot in class Device
Parameters:
robot - unused

getRobot

public final Robot getRobot()
Returns null. No robot is used for a PseudoDevice.

Overrides:
getRobot in class Device
Returns:
null

readStateFromRobot

public final void readStateFromRobot()
This method just calls readStateFromPseudoDevice. This is done purely for the semantic meaning of the names.

Specified by:
readStateFromRobot in class Device

freeze

public void freeze()
Does nothing. Typically there is nothing to freeze in a PseudoDevice. Though if there is, this method can be overridden.

Specified by:
freeze in class Device

readStateFromPseudoDevice

public abstract void readStateFromPseudoDevice()
Reads the state of the Pseudo device. This method will update cached values of the device state and invoke the setChanged method if the state has changed.


dLife Home Page