All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----gerken.vehicles.SimulationParticipant
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.
If the participant doesn't already have a debug window, give it one
If the participant has a debug window then the participant will write debug information to that window.
Display the receiver using the given Graphics.
Display the receiver in such a way as to indicate that the receiver is broken.
Return the angle from the receiver to the location.
Return the brightness of this participant.
Calculate and return the brightness of an object.
Return the participant's color.
Tell the user what we can about the participant's execution state.
Return the DisplayCoordinates cooresponding to the participant's location
Return whether the participant is still active in the simulation.
Return a Location representing the participants location
Return the offset (in the form of a Location) from the receiver to the location.
Return the scenario in charge of the participant's simulation.
Return the participant's x coordinate.
Return the participant's y coordinate.
Return whether the participant has a single point position.
Set the participant's brightness.
Set whether the participant is still active in the simulation.
Set the participant's x coordinate.
Set the participant's y coordinate.
public void beginDebug()
If the participant doesn't already have a debug window, give it one
public void debug()
If the participant has a debug window then the participant will write debug information to that window.
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.
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.
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.
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
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.
public Color getColor()
Return the participant's color.
public String getDebugText()
Tell the user what we can about the participant's execution state.
public abstract String getDescription()
public DisplayCoordinates getDisplayCoordinates()
Return the DisplayCoordinates cooresponding to the participant's location
public boolean getIsActive()
Return whether the participant is still active in the simulation.
public Location getLocation()
Return a Location representing the participants location
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.
public VehicleScenario getScenario()
Return the scenario in charge of the participant's simulation.
public double getX()
Return the participant's x coordinate.
public double getY()
Return the participant's y coordinate.
public abstract boolean hasPointLocation()
Return whether the participant has a single point position.
public void setBrightness(double value)
Set the participant's brightness.
public void setIsActive(boolean value)
Set whether the participant is still active in the simulation.
public void setX(double value)
Set the participant's x coordinate.
public void setY(double value)
Set the participant's y coordinate.
public abstract void step()
All Packages Class Hierarchy This Package Previous Next Index