uchicago.src.repastdemos.rabbitPopulation
Class PopulationDensity

java.lang.Object
  extended by uchicago.src.sim.network.DefaultNode
      extended by uchicago.src.sim.network.DefaultDrawableNode
          extended by uchicago.src.repastdemos.rabbitPopulation.PopulationDensity
All Implemented Interfaces:
CustomProbeable, Drawable2DGridNode, DrawableNonGridNode, Moveable, Named, NonGridDrawable, Node

public class PopulationDensity
extends DefaultDrawableNode
implements CustomProbeable, Named

Calculates the population density based on the current population of rabbits and the current area. This encapsulates the population density equation in the Rabbit Population model. The equation is: population / area where population is the current rabbit population.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class uchicago.src.sim.network.DefaultNode
DefaultNode.OrderedHashMap
 
Field Summary
 
Fields inherited from class uchicago.src.sim.network.DefaultDrawableNode
item
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, label, outEdges, outMap
 
Constructor Summary
PopulationDensity(CEquationFactory factory)
          Creates a PopulationDensity using the specified CEquationFactory.
 
Method Summary
 float getArea()
           
 double getDensity()
           
 CEquation getEquation()
           
 java.lang.String getName()
           
 double getPopulation()
           
 java.lang.String[] getProbedProperties()
          Gets the names of the properties that are allowed to be probed.
 void init(RabbitPopulation population)
          Initialize this PopulationDensity.
 void setArea(float area)
           
 void setDensity(double density)
           
 void setEquation(CEquation equation)
           
 
Methods inherited from class uchicago.src.sim.network.DefaultDrawableNode
allowResizing, calcSize, contains, draw, getBorderColor, getBorderWidth, getColor, getFont, getHeight, getLabelColor, getNode, getWidth, getX, getY, setBorderColor, setBorderWidth, setColor, setDrawable, setDrawableNoCopy, setFont, setHeight, setLabelColor, setNodeLabel, setWidth, setX, setX, setY, setY
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getId, getInDegree, getInEdges, getInNodes, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.DrawableNonGridNode
getOutEdges
 
Methods inherited from interface uchicago.src.sim.gui.Drawable2DGridNode
getOutEdges
 

Constructor Detail

PopulationDensity

public PopulationDensity(CEquationFactory factory)
Creates a PopulationDensity using the specified CEquationFactory. This factory creates a CEquation and schedules that CEquation's assignment and evaluation.

Parameters:
factory -
Method Detail

init

public void init(RabbitPopulation population)
Initialize this PopulationDensity. The RabbitPopulation is queried for the current population when the CEquation encapsulated by this PopulationDensity instance is evaluated.

Parameters:
population -

getEquation

public CEquation getEquation()

setEquation

public void setEquation(CEquation equation)

getPopulation

public double getPopulation()

getArea

public float getArea()

setArea

public void setArea(float area)

getDensity

public double getDensity()

setDensity

public void setDensity(double density)

getName

public java.lang.String getName()
Specified by:
getName in interface Named
Returns:
the name of this object

getProbedProperties

public java.lang.String[] getProbedProperties()
Description copied from interface: CustomProbeable
Gets the names of the properties that are allowed to be probed. The property names returned by this method should be reflect the accessor and mutator method names. For example, given getAge and setAge, an appropriate property name would be Age.

Specified by:
getProbedProperties in interface CustomProbeable
Returns:
an array of the property names.