Class Truck

java.lang.Object
  extended bySimpleTurtle
      extended byTurtle
          extended byAgent
              extended byDEAgent
                  extended byTruck

public class Truck
extends DEAgent

Truck -- delivers product from Factory to Warehouse.


Field Summary
static int FACTORY_ARRIVE
           
 int load
          Amount of product being carried
static int WAREHOUSE_ARRIVE
           
 
Fields inherited from class DEAgent
blocked
 
Fields inherited from class Agent
MAXSPEED, myPict, PROB_OF_STAY, randNumGen, simulation, speed
 
Constructor Summary
Truck(int x, int y, ModelDisplay modelDisplayer, Simulation thisSim)
          Constructor that takes the x and y and a model display to draw it on
Truck(ModelDisplay modelDisplayer, Simulation thisSim)
          Constructor that takes the model display (the original position will be randomly assigned)
 
Method Summary
 void init(Simulation thisSim)
          Set up the truck Start out at the factory
 int newLoad()
          A new load is between 10 and 20 on a uniform distribution
 void processEvent(int message)
          Process an event.
 double tripTime()
          A trip distance averages 3 days
 
Methods inherited from class DEAgent
isBlocked, isReady, unblocked, validTime, waitFor
 
Methods inherited from class Agent
act, act, countInRange, die, getClosest, getSimulation, getSpeed, setSpeed
 
Methods inherited from class Turtle
square
 
Methods inherited from class SimpleTurtle
backward, drawInfoString, drop, forward, forward, getBodyColor, getDistance, getHeading, getInfoColor, getModelDisplay, getName, getPen, getPenColor, getPenWidth, getPicture, getShellColor, getShowInfo, getXPos, getYPos, hide, isPenDown, isVisible, moveTo, paintComponent, penDown, penUp, setBodyColor, setColor, setHeading, setInfoColor, setModelDisplay, setName, setPen, setPenColor, setPenDown, setPenWidth, setPicture, setShellColor, setShowInfo, setVisible, show, toString, turn, turnLeft, turnRight, turnToFace, turnToFace, updateDisplay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FACTORY_ARRIVE

public static final int FACTORY_ARRIVE
See Also:
Constant Field Values

WAREHOUSE_ARRIVE

public static final int WAREHOUSE_ARRIVE
See Also:
Constant Field Values

load

public int load
Amount of product being carried

Constructor Detail

Truck

public Truck(ModelDisplay modelDisplayer,
             Simulation thisSim)
Constructor that takes the model display (the original position will be randomly assigned)

Parameters:
modelDisplayer - thing that displays the model
thisSim - my simulation

Truck

public Truck(int x,
             int y,
             ModelDisplay modelDisplayer,
             Simulation thisSim)
Constructor that takes the x and y and a model display to draw it on

Parameters:
x - the starting x position
y - the starting y position
modelDisplayer - the thing that displays the model
thisSim - my simulation
Method Detail

newLoad

public int newLoad()
A new load is between 10 and 20 on a uniform distribution


tripTime

public double tripTime()
A trip distance averages 3 days


init

public void init(Simulation thisSim)
Set up the truck Start out at the factory

Overrides:
init in class DEAgent

processEvent

public void processEvent(int message)
Process an event. Default is to do nothing with it.

Overrides:
processEvent in class DEAgent