All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gerken.vehicles.Light

java.lang.Object
   |
   +----gerken.vehicles.SimulationParticipant
           |
           +----gerken.vehicles.Light

public class Light
extends SimulationParticipant

A Light is a simulation participant that basically sits still and produces a constant light (much as you would expect). Its screen representation is that of a small colored circle, just as a light bulb might appear from the top. When the light is broken by a vehicle that gets too close, the light goes out.

This software is provided on an as-is basis and is copyright Chris Gerken. The only rights granted to you are to enjoy and learn from this software.


Constructor Index

 o Light(double, double, Color)

Return a light at location (x,y) which produces c colored light.

Method Index

 o display(Graphics)

Tell the Light to display itself using the given Graphics.

 o displayBroken(Graphics)

Tell the Light to display itself as being broken using the given Graphics.

 o getDescription()

Return a string describing this light.

 o hasPointLocation()

Answer true to indicate that this light does in fact have a location.

 o step()

Perform light-specific simulation tasks

Constructors

 o Light
 public Light(double x,
              double y,
              Color c)

Return a light at location (x,y) which produces c colored light. The light must still be registered with the scenario in order to participate in the simulation.

Parameters:
x - double
y - double
c - java.awt.Color
See Also:
addParticipant

Methods

 o display
 public void display(Graphics g)

Tell the Light to display itself using the given Graphics.

Parameters:
c - java.awt.Graphics
Overrides:
display in class SimulationParticipant
 o displayBroken
 public void displayBroken(Graphics g)

Tell the Light to display itself as being broken using the given Graphics.

Parameters:
c - java.awt.Graphics
Overrides:
displayBroken in class SimulationParticipant
 o getDescription
 public String getDescription()

Return a string describing this light.

Returns:
java.lang.String
Overrides:
getDescription in class SimulationParticipant
 o hasPointLocation
 public boolean hasPointLocation()

Answer true to indicate that this light does in fact have a location.

Returns:
boolean
Overrides:
hasPointLocation in class SimulationParticipant
 o step
 public void step()

Perform light-specific simulation tasks

Overrides:
step in class SimulationParticipant

All Packages  Class Hierarchy  This Package  Previous  Next  Index