All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----gerken.vehicles.SimulationParticipant
|
+----gerken.vehicles.Light
|
+----gerken.vehicles.Pulsar
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.
Return a Pulsar at location (x,y) which produces c colored light and whose brightness will vary for a period of length p steps.
Tell the pulsar to display itself using the given Graphics.
Tell the pulsar to display itself as being broken using the given Graphics.
Return a string describing this pulsar.
Return the current brightness based on phase and period.
Increment the number of steps that have passed and use that number to calculate the new brightness.
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.
public void display(Graphics g)
Tell the pulsar to display itself using the given Graphics.
public void displayBoken(Graphics g)
Tell the pulsar to display itself as being broken using the given Graphics.
public String getDescription()
Return a string describing this pulsar.
public double getVariableBrightness()
Return the current brightness based on phase and period.
public void step()
Increment the number of steps that have passed and use that number to calculate the new brightness.
All Packages Class Hierarchy This Package Previous Next Index