Class DEAgent

java.lang.Object
  extended bySimpleTurtle
      extended byTurtle
          extended byAgent
              extended byDEAgent
Direct Known Subclasses:
Distributor, Truck

public class DEAgent
extends Agent

DEAgent - an agent in a Discrete Event simulation A DEAgent doesn't act(). A DEAgent adds events to the queue, and requests resources.


Field Summary
 boolean blocked
          For support of resources
 
Fields inherited from class Agent
MAXSPEED, myPict, PROB_OF_STAY, randNumGen, simulation, speed
 
Constructor Summary
DEAgent(int x, int y, ModelDisplay modelDisplayer, Simulation thisSim)
          Constructor that takes the x and y and a model display to draw it on
DEAgent(ModelDisplay modelDisplayer, Simulation thisSim)
          Constructor that takes the model display (the original position will be randomly assigned)
 
Method Summary
 void init(Simulation thisSim)
          Method to initialize the new wolf object
 boolean isBlocked()
          Are we blocked?
 boolean isReady(Resource res)
          Are we ready to be unlocked?
 void processEvent(int message)
          Process an event.
 void unblocked(Resource resource)
          I've been unblocked!
 double validTime(double delay)
          Provide a time that's not negative
 void waitFor(Resource resource)
          Block myself for the input resource
 
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

blocked

public boolean blocked
For support of resources

Constructor Detail

DEAgent

public DEAgent(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

DEAgent

public DEAgent(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

init

public void init(Simulation thisSim)
Description copied from class: Agent
Method to initialize the new wolf object

Overrides:
init in class Agent

isBlocked

public boolean isBlocked()
Are we blocked?


isReady

public boolean isReady(Resource res)
Are we ready to be unlocked?


validTime

public double validTime(double delay)
Provide a time that's not negative


waitFor

public void waitFor(Resource resource)
Block myself for the input resource

Parameters:
resource - the desired resource

unblocked

public void unblocked(Resource resource)
I've been unblocked!

Parameters:
resource - the desired resource

processEvent

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