All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----gerken.vehicles.SimulationParticipant
|
+----gerken.vehicles.Vehicle
A Vehicle is a simulation participant that has the ability to move about the simulation area. Each vehicle has a single VehicleNetwork that processes information about the vehicles' environment (gathered by light receptors in the network) and then drives two motors (one for each rear wheel). As a result, the vehcile is able to respond to its environment by moving. across the simulation area.
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.
Adds c to the set of participant colors that the vehicle can break.
Adds c to the set of participant colors that can break the vehicle.
Return a basic blue vehicle.
Return a vehicle that chases after chasedColor participants.
Return a vehicle colored vehicleColor that moves straight ahead and never turns.
Display the vehicle using the Graphics.
"Erase" the old screen representation by drawing the vehicle in its old location using the background color.
Return the maximum distance from this vehicle can be broken (rendered inactive) or from which this vehicle can break other participants.
Return a Vector containing the colors of participants that this vehicle can break.
Return a Vector containing the colors of participants that can break this vehicle.
Build and return a String containing execution state for the vehicle
Return a string describing this vehicle.
Return the direction in which this vehicle is heading.
Return the distance traveled by this vehicle when both wheels move forward.
Return a basic green vehicle.
Vehicles have single point locations, so answer true.
Return a lemming vehicle
Calculate and save the vehicle's new position assuming that both wheels move.
Return a vehicle that orbits participants colored orbitedColor.
Return a basic red vehicle.
Return whether the motor driving the left wheel will run during this simulation step.
Return whether the motor driving the right wheel will run during this simulation step.
Set the distance this vehicle will move when both wheels move forward.
Calculate the vehicle's new position should it not move (hint: the position doesn't change.
Perform the simulation logic for a single step.
Turn the vehicle's direction by angle.
Return the angle in radians that a vehicle will turn when only one of its wheels move.
Turn the vehicle to the left.
Turn the vehicle to the right.
Return a basic yellow vehicle.
public Vehicle(double x,
double y,
double d,
Color c,
VehicleNetwork n)
public void addBreaksColor(Color c)
Adds c to the set of participant colors that the vehicle can break. If this vehicle gets close to any other participant colored c, that participant will be rendered inActive and will be removed from the simulation.
public void addBrokenByColor(Color c)
Adds c to the set of participant colors that can break the vehicle. If this vehicle gets close to any other participant colored c, this vehicle will be rendered inActive and will be removed from the simulation.
public static Vehicle blue(double x,
double y,
double d)
Return a basic blue vehicle.
public static Vehicle chaser(double x,
double y,
double d,
Color vehicleColor,
Color chasedColor)
Return a vehicle that chases after chasedColor participants.
public static Vehicle cruiser(double x,
double y,
double d,
Color vehicleColor)
Return a vehicle colored vehicleColor that moves straight ahead and never turns.
public void display(Graphics g)
Display the vehicle using the Graphics. First "erase" the old screen representation by drawing the vehicle in its old location using the background color and then draw the vehicle in its new location using the vehicle's real color.
public void displayBroken(Graphics g)
"Erase" the old screen representation by drawing the vehicle in its old location using the background color. The vehicle is no longer active and will be removed from the scenario.
public double getBreakDistance()
Return the maximum distance from this vehicle can be broken (rendered inactive) or from which this vehicle can break other participants.
public Vector getBreaks()
Return a Vector containing the colors of participants that this vehicle can break.
public Vector getBrokenBy()
Return a Vector containing the colors of participants that can break this vehicle.
public String getDebugText()
Build and return a String containing execution state for the vehicle
public String getDescription()
Return a string describing this vehicle.
public double getDirection()
Return the direction in which this vehicle is heading. Angles are expressed in radians.
public double getSpeed()
Return the distance traveled by this vehicle when both wheels move forward.
public static Vehicle green(double x,
double y,
double d)
Return a basic green vehicle.
public boolean hasPointLocation()
Vehicles have single point locations, so answer true.
public static Vehicle lemming(double x,
double y,
double d)
Return a lemming vehicle
public void moveForward()
Calculate and save the vehicle's new position assuming that both wheels move.
public static Vehicle orbiter(double x,
double y,
double d,
Color vehicleColor,
Color orbitedColor)
Return a vehicle that orbits participants colored orbitedColor.
public static Vehicle red(double x,
double y,
double d)
Return a basic red vehicle.
public boolean runLeftMotor()
Return whether the motor driving the left wheel will run during this simulation step.
public boolean runRightMotor()
Return whether the motor driving the right wheel will run during this simulation step.
public void setSpeed(double value)
Set the distance this vehicle will move when both wheels move forward.
public void standStill()
Calculate the vehicle's new position should it not move (hint: the position doesn't change.
public void step()
Perform the simulation logic for a single step. After the network processes the light inputs, move the vehicle as appropriate.
public void turn(double angle)
Turn the vehicle's direction by angle. The position of the vehicle does not change.
public double turnAngle()
Return the angle in radians that a vehicle will turn when only one of its wheels move.
public void turnLeft()
Turn the vehicle to the left.
public void turnRight()
Turn the vehicle to the right.
public static Vehicle yellow(double x,
double y,
double d)
Return a basic yellow vehicle.
All Packages Class Hierarchy This Package Previous Next Index