All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gerken.vehicles.Pulsar

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

public class Pulsar
extends Light

A Pulsar is a special kind of Light that changes in brightness over time. Its screen representation is that of a small colored circle whose radius varies between the radius of a normal Light when the Pulsar's brightness is at its peak and 0 (zero) when the Pulsar is at its dimmest. In addition to all of the properties inherited from Light, Pulsars have an additional property, a double period, which is the number of simulation steps required for the Pulsar's brightness to change from peak to peak.

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 Pulsar(double, double, double, Color)

Return a Pulsar at location (x,y) which produces c colored light and whose brightness will vary for a period of length p steps.

Method Index

 o display(Graphics)

Tell the pulsar to display itself using the given Graphics.

 o displayBoken(Graphics)

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

 o getDescription()

Return a string describing this pulsar.

 o getVariableBrightness()

Return the current brightness based on phase and period.

 o step()

Increment the number of steps that have passed and use that number to calculate the new brightness.

Constructors

 o Pulsar
 public Pulsar(double x,
               double y,
               double p,
               Color c)

Return a Pulsar at location (x,y) which produces c colored light and whose brightness will vary for a period of length p steps. The Pulsar must still be registered with the scenario in order to participate in the simulation.

Parameters:
x - double
y - double
p - double
c - Color

Methods

 o display
 public void display(Graphics g)

Tell the pulsar to display itself using the given Graphics.

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

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

Parameters:
c - java.awt.Graphics
 o getDescription
 public String getDescription()

Return a string describing this pulsar.

Returns:
java.lang.String
Overrides:
getDescription in class Light
 o getVariableBrightness
 public double getVariableBrightness()

Return the current brightness based on phase and period.

 o step
 public void step()

Increment the number of steps that have passed and use that number to calculate the new brightness.

Overrides:
step in class Light

All Packages  Class Hierarchy  This Package  Previous  Next  Index