All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gerken.vehicles.SimulationParticipant

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

public abstract class SimulationParticipant
extends Object

The SimulationParticipant type is a abstract superclass for all types of participants in a vehicle simulation. Subclasses should implement the following behaviors:

The following properties are supported by this type:

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.

See Also:
SimulationParticipant

Method Index

 o beginDebug()

If the participant doesn't already have a debug window, give it one

 o debug()

If the participant has a debug window then the participant will write debug information to that window.

 o display(Graphics)

Display the receiver using the given Graphics.

 o displayBroken(Graphics)

Display the receiver in such a way as to indicate that the receiver is broken.

 o getAngleTo(Location)

Return the angle from the receiver to the location.

 o getBrightness()

Return the brightness of this participant.

 o getBrightnessFrom(SimulationParticipant)

Calculate and return the brightness of an object.

 o getColor()

Return the participant's color.

 o getDebugText()

Tell the user what we can about the participant's execution state.

 o getDescription()

 o getDisplayCoordinates()

Return the DisplayCoordinates cooresponding to the participant's location

 o getIsActive()

Return whether the participant is still active in the simulation.

 o getLocation()

Return a Location representing the participants location

 o getOffsetTo(Location)

Return the offset (in the form of a Location) from the receiver to the location.

 o getScenario()

Return the scenario in charge of the participant's simulation.

 o getX()

Return the participant's x coordinate.

 o getY()

Return the participant's y coordinate.

 o hasPointLocation()

Return whether the participant has a single point position.

 o setBrightness(double)

Set the participant's brightness.

 o setIsActive(boolean)

Set whether the participant is still active in the simulation.

 o setX(double)

Set the participant's x coordinate.

 o setY(double)

Set the participant's y coordinate.

 o step()
This method written by Chris Gerken (gerken

Methods

 o beginDebug
 public void beginDebug()

If the participant doesn't already have a debug window, give it one

 o debug
 public void debug()

If the participant has a debug window then the participant will write debug information to that window.

 o display
 public abstract void display(Graphics g)

Display the receiver using the given Graphics. This implementation does nothing, leaving it to subclasses to perform the correct drawing behavior.

Note that the coordinate system used by the graphics system puts coordinate (0,0) in the upper left hand corner while both mathematical calculations and display logic for participant simulation put (0,0) and the left hand bottom of the screen.

Parameters:
c - java.awt.Graphics
 o displayBroken
 public abstract void displayBroken(Graphics g)

Display the receiver in such a way as to indicate that the receiver is broken. this implementation does nothing, leaving it to subclasses to perform the correct drawing behavior.

Note that the coordinate system used by the graphics system puts coordinate (0,0) in the upper left hand corner while both mathematical calculations and display logic for participant simulation put (0,0) and the left hand bottom of the screen.

Parameters:
c - java.awt.Graphics
 o getAngleTo
 public double getAngleTo(Location l)

Return the angle from the receiver to the location. Note that if the scenario wraps around, the shortest distance (and therefore the angle) to the location may be across a scenario boundary.

Parameters:
l - com.gerken.vehicles.VehicleLocation
Returns:
double
 o getBrightness
 public double getBrightness()

Return the brightness of this participant. The brighter a participant is, the more it will register on other vehicle's receptors. The default brightness is 1.0

Returns:
double
 o getBrightnessFrom
 public double getBrightnessFrom(SimulationParticipant participant)

Calculate and return the brightness of an object. The brightness will vary based on the distance to the participant and the participant's actual brightness.

Parameters:
participant - gerken.vehicles.SimulationParticipant
Returns:
double
 o getColor
 public Color getColor()

Return the participant's color.

Returns:
java.awt.Color
 o getDebugText
 public String getDebugText()

Tell the user what we can about the participant's execution state.

Returns:
java.lang.String
 o getDescription
 public abstract String getDescription()

Returns:
java.lang.String
 o getDisplayCoordinates
 public DisplayCoordinates getDisplayCoordinates()

Return the DisplayCoordinates cooresponding to the participant's location

Returns:
gerken.vehicles.DisplayCoordinates
 o getIsActive
 public boolean getIsActive()

Return whether the participant is still active in the simulation.

Returns:
boolean
 o getLocation
 public Location getLocation()

Return a Location representing the participants location

Returns:
gerken.vehicles.VehicleLocation
 o getOffsetTo
 public Location getOffsetTo(Location l)

Return the offset (in the form of a Location) from the receiver to the location. If the owning scenario wraps around, the distances between the two locations across scenario boundaries will be considered.

Parameters:
l - gerken.vehicles.Location
Returns:
gerken.vehicles.Location
 o getScenario
 public VehicleScenario getScenario()

Return the scenario in charge of the participant's simulation.

Returns:
gerken.vehicles.SimulationScenario
 o getX
 public double getX()

Return the participant's x coordinate.

Returns:
double
 o getY
 public double getY()

Return the participant's y coordinate.

Returns:
double
 o hasPointLocation
 public abstract boolean hasPointLocation()

Return whether the participant has a single point position.

Returns:
boolean
 o setBrightness
 public void setBrightness(double value)

Set the participant's brightness.

Parameters:
value - double
 o setIsActive
 public void setIsActive(boolean value)

Set whether the participant is still active in the simulation.

Parameters:
value - boolean
 o setX
 public void setX(double value)

Set the participant's x coordinate.

Parameters:
value - double
 o setY
 public void setY(double value)

Set the participant's y coordinate.

Parameters:
value - double
 o step
 public abstract void step()
This method written by Chris Gerken (gerken@mindspring.com).


All Packages  Class Hierarchy  This Package  Previous  Next  Index