uchicago.src.repastdemos.mousetrap
Class MouseTrap

java.lang.Object
  extended by uchicago.src.repastdemos.mousetrap.MouseTrap
All Implemented Interfaces:
DescriptorContainer, Drawable

public class MouseTrap
extends java.lang.Object
implements Drawable, DescriptorContainer

The "mousetrap" agent object. A mousetrap contains some n number of balls when triggered, it will throw these balls into the air to land on other mousetraps. This is implemented in the trigger method. There are no actual ball objects but their effect is simulated by finding some n number of neighbors where n is the number of "balls" and scheduling their trigger methods for some time in the "near" future.

Version:
$Revision: 1.1 $ $Date: 2005/08/12 20:04:58 $
Author:
Nick Collier
See Also:
MouseTrapModel

Constructor Summary
MouseTrap(int x, int y, MouseTrapModel model, Object2DTorus space)
           
 
Method Summary
 void draw(SimGraphics g)
          Invoked when the object should draw itself
 java.util.Hashtable getParameterDescriptors()
          Returns a java.util.Hashtable whose keys are parameters names, and whose values are uchicago.src.reflector.PropertyDescriptors.
 int getX()
          Gets the x coordinate of this drawable.
 int getY()
          Gets the y coordinate of the this drawable.
 boolean isTriggered()
           
 void setTriggered(boolean val)
           
 void trigger()
          Triggers this MouseTrap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseTrap

public MouseTrap(int x,
                 int y,
                 MouseTrapModel model,
                 Object2DTorus space)
Method Detail

isTriggered

public boolean isTriggered()

setTriggered

public void setTriggered(boolean val)

trigger

public void trigger()
Triggers this MouseTrap. Triggering simulates the throwing of some number of balls into the air and having them land on some number of neighboring mousetraps. This is accomplished by finding some number of neighboring mousetraps on the torus and scheduling their trigger methods for some time in the near future.


getX

public int getX()
Description copied from interface: Drawable
Gets the x coordinate of this drawable. Note that this should return the x coordinate in some space, not necessarily a screen coordinate.

Specified by:
getX in interface Drawable

getY

public int getY()
Description copied from interface: Drawable
Gets the y coordinate of the this drawable. Note that this should return the y coordinate in some space, not necessarily a screen coordinate.

Specified by:
getY in interface Drawable

draw

public void draw(SimGraphics g)
Description copied from interface: Drawable
Invoked when the object should draw itself

Specified by:
draw in interface Drawable

getParameterDescriptors

public java.util.Hashtable getParameterDescriptors()
Description copied from interface: DescriptorContainer
Returns a java.util.Hashtable whose keys are parameters names, and whose values are uchicago.src.reflector.PropertyDescriptors.

Specified by:
getParameterDescriptors in interface DescriptorContainer