uk.ac.ucl.casa.andrew.phd.segModelPreferencesForBothLike
Class UrbanAgent

java.lang.Object
  extended byuk.ac.ucl.casa.andrew.phd.segModelPreferencesForBothLike.UrbanAgent
All Implemented Interfaces:
anl.repast.gis.GisAgent, anl.repast.gis.OpenMapAgent

public class UrbanAgent
extends java.lang.Object
implements anl.repast.gis.OpenMapAgent, anl.repast.gis.GisAgent

Extends basic polygon agent and acts as a container for resident agents

Author:
Andrew Crooks
Centre for Advanced Spatial Analysis, University College London.

Field Summary
(package private)  int actualPopBlue
           
(package private)  int actuualPopRed
           
private  int ageResident
           
(package private)  double area
           
(package private)  int bluePopPercentage
           
(package private)  int bluePopulationRedisdents
           
private static com.vividsolutions.jts.geom.Geometry bufferedUnionGeometry
           
(package private)  int determinepop
           
(package private)  int gisAgentIndex
           
(package private)  double id
           
(package private)  int landuse
           
(package private) static org.apache.log4j.Category log
           
(package private)  SegGISModel model
           
(package private)  int[] neighbors
           
private  int numResidentAgents
           
(package private)  com.bbn.openmap.omGraphics.OMGraphic omGraphic
           
private  java.lang.Object placementOfAgents
           
private  com.vividsolutions.jts.geom.Point Point
           
(package private)  double population
           
private  com.bbn.openmap.omGraphics.OMPoint randomPoints
           
(package private)  int redPopPercentage
           
(package private)  int redPopulationRedisdents
           
private  java.util.ArrayList residentAgents
           
(package private)  java.lang.String socclass
           
private  java.lang.String socResident
           
(package private)  com.vividsolutions.jts.geom.MultiPolygon the_geom
           
(package private)  int totalPopulationRedisdents
           
(package private)  int totalResCountPerCell
           
(package private)  int type
           
private static com.vividsolutions.jts.geom.Geometry unionGeometry
           
private  java.util.ArrayList urbanAgentList
           
(package private)  java.lang.String ward
           
 
Constructor Summary
UrbanAgent()
           
 
Method Summary
static java.util.HashMap countResidentTypes(java.util.ArrayList residents)
           
 double determineLandUse()
           
 int determinepop()
           
 void determinPopulationPercentage()
           
 double getAREA()
           
 double getAreaJTS()
           
 int getBLUE()
           
 int getBLUENO()
           
static com.vividsolutions.jts.geom.Geometry getBufferedGeometry(java.util.ArrayList urbanAgentList)
          This method creates a new geometry off the bounding area and is used in randomPointforNewAgent method because it was noticed that due to rounding errors of switching from an Vivid slolutions Point to OMCircle (float) that the Lat and often changed by a few 0.00 decimal degrees therefore the new agent would be drawn outside of the area which is a problem when trying to move the agent is steprestrict
 int getdeterminepop()
           
 java.awt.Paint getFillPaint()
           
 com.vividsolutions.jts.geom.Geometry getGeometry()
           
 int getGisAgentIndex()
           
 java.lang.Double getid_id()
           
 int getLANDUSE()
           
 int[] getNeighbors()
           
 com.bbn.openmap.omGraphics.OMGraphic getOMGraphic()
           
 java.lang.Double getPOPU()
           
 int getRED()
           
 int getREDNO()
           
 java.lang.String getSOC()
           
static com.vividsolutions.jts.geom.Geometry getUnion(java.util.ArrayList urbanAgentList)
           
 java.lang.String getWARD_ID()
           
 java.lang.String[] gisPropertyList()
           
static java.util.HashMap percentageResidentTypes(java.util.ArrayList residents)
           
 double popDensity(boolean popdensityOff)
          initially there is a problems with rounding errors of % around 3% but this changes as the model developes.
 void postStep(java.util.ArrayList urbanAgentList)
           
 void preStep()
           
 com.bbn.openmap.omGraphics.OMPoint randomPoint()
           
static void reset()
           
 void setAREA(double area)
           
 void setBLUE(int blue)
           
 void setBLUENO(int actualPopBlue)
           
 void setdeterminepop(int determinepop)
           
 void setGisAgentIndex(int index)
           
 void setid_id(java.lang.Double id_id)
           
 void setLANDUSE(int landuse)
           
 void setModel(SegGISModel model)
           
 void setNeighbors(int[] neighbors)
           
 void setOMGraphic(com.bbn.openmap.omGraphics.OMGraphic arg0)
           
 void setPOPU(java.lang.Double popu)
           
 void setRED(int red)
           
 void setREDNO(int actuualPopRed)
           
 void setResidentAgents(java.util.ArrayList residentAgents)
          called by SegGISModel.buildModel method, creates resident agents for each urban agent.
 void setSOC(java.lang.String soc)
           
 void setUpResidents()
           
 void setWARD_ID(java.lang.String ward_id)
           
 java.util.HashMap soccialclassShouldbe()
          creates a hashmap of the types resident percentages within each urban agent, uesed when the population is being created.
 void socialClassOfUrbanAgent()
          Takes a list of residents and calucates the landuse within a * a polygon based on the agents present.
 void step()
           
 java.util.ArrayList urbanAgentContainsResidents(boolean popdensityOff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.log4j.Category log

residentAgents

private java.util.ArrayList residentAgents

urbanAgentList

private java.util.ArrayList urbanAgentList

model

SegGISModel model

gisAgentIndex

int gisAgentIndex

neighbors

int[] neighbors

landuse

int landuse

type

int type

area

double area

population

double population

id

double id

determinepop

int determinepop

totalResCountPerCell

int totalResCountPerCell

omGraphic

com.bbn.openmap.omGraphics.OMGraphic omGraphic

the_geom

com.vividsolutions.jts.geom.MultiPolygon the_geom

socclass

java.lang.String socclass

ward

java.lang.String ward

placementOfAgents

private java.lang.Object placementOfAgents

numResidentAgents

private int numResidentAgents

Point

private com.vividsolutions.jts.geom.Point Point

randomPoints

private com.bbn.openmap.omGraphics.OMPoint randomPoints

socResident

private java.lang.String socResident

ageResident

private int ageResident

unionGeometry

private static com.vividsolutions.jts.geom.Geometry unionGeometry

bufferedUnionGeometry

private static com.vividsolutions.jts.geom.Geometry bufferedUnionGeometry

redPopPercentage

int redPopPercentage

bluePopPercentage

int bluePopPercentage

redPopulationRedisdents

int redPopulationRedisdents

bluePopulationRedisdents

int bluePopulationRedisdents

totalPopulationRedisdents

int totalPopulationRedisdents

actuualPopRed

int actuualPopRed

actualPopBlue

int actualPopBlue
Constructor Detail

UrbanAgent

public UrbanAgent()
Method Detail

reset

public static void reset()

getBufferedGeometry

public static com.vividsolutions.jts.geom.Geometry getBufferedGeometry(java.util.ArrayList urbanAgentList)
This method creates a new geometry off the bounding area and is used in randomPointforNewAgent method because it was noticed that due to rounding errors of switching from an Vivid slolutions Point to OMCircle (float) that the Lat and often changed by a few 0.00 decimal degrees therefore the new agent would be drawn outside of the area which is a problem when trying to move the agent is steprestrict

Parameters:
urbanAgentList -
Returns:

setResidentAgents

public void setResidentAgents(java.util.ArrayList residentAgents)
called by SegGISModel.buildModel method, creates resident agents for each urban agent. The method is only called in the build model process.

Parameters:
residentAgents -

socialClassOfUrbanAgent

public void socialClassOfUrbanAgent()
Takes a list of residents and calucates the landuse within a * a polygon based on the agents present.


step

public void step()

preStep

public void preStep()

postStep

public void postStep(java.util.ArrayList urbanAgentList)

setUpResidents

public void setUpResidents()

randomPoint

public com.bbn.openmap.omGraphics.OMPoint randomPoint()

determineLandUse

public double determineLandUse()

getGisAgentIndex

public int getGisAgentIndex()
Specified by:
getGisAgentIndex in interface anl.repast.gis.GisAgent

setGisAgentIndex

public void setGisAgentIndex(int index)
Specified by:
setGisAgentIndex in interface anl.repast.gis.GisAgent

setModel

public void setModel(SegGISModel model)

gisPropertyList

public java.lang.String[] gisPropertyList()
Specified by:
gisPropertyList in interface anl.repast.gis.GisAgent

setNeighbors

public void setNeighbors(int[] neighbors)
Specified by:
setNeighbors in interface anl.repast.gis.GisAgent

getNeighbors

public int[] getNeighbors()
Specified by:
getNeighbors in interface anl.repast.gis.GisAgent

getFillPaint

public java.awt.Paint getFillPaint()
Specified by:
getFillPaint in interface anl.repast.gis.OpenMapAgent

setREDNO

public void setREDNO(int actuualPopRed)

getREDNO

public int getREDNO()

setBLUENO

public void setBLUENO(int actualPopBlue)

getBLUENO

public int getBLUENO()

getAREA

public double getAREA()

setAREA

public void setAREA(double area)

getAreaJTS

public double getAreaJTS()

setRED

public void setRED(int red)

getRED

public int getRED()

setBLUE

public void setBLUE(int blue)

getBLUE

public int getBLUE()

setPOPU

public void setPOPU(java.lang.Double popu)

getPOPU

public java.lang.Double getPOPU()

setLANDUSE

public void setLANDUSE(int landuse)

getLANDUSE

public int getLANDUSE()

setSOC

public void setSOC(java.lang.String soc)

getSOC

public java.lang.String getSOC()

setWARD_ID

public void setWARD_ID(java.lang.String ward_id)

getWARD_ID

public java.lang.String getWARD_ID()

setid_id

public void setid_id(java.lang.Double id_id)

getid_id

public java.lang.Double getid_id()

determinepop

public int determinepop()

determinPopulationPercentage

public void determinPopulationPercentage()

soccialclassShouldbe

public java.util.HashMap soccialclassShouldbe()
creates a hashmap of the types resident percentages within each urban agent, uesed when the population is being created.


setdeterminepop

public void setdeterminepop(int determinepop)

getdeterminepop

public int getdeterminepop()

getOMGraphic

public com.bbn.openmap.omGraphics.OMGraphic getOMGraphic()
Specified by:
getOMGraphic in interface anl.repast.gis.OpenMapAgent

setOMGraphic

public void setOMGraphic(com.bbn.openmap.omGraphics.OMGraphic arg0)
Specified by:
setOMGraphic in interface anl.repast.gis.OpenMapAgent

getGeometry

public com.vividsolutions.jts.geom.Geometry getGeometry()

getUnion

public static com.vividsolutions.jts.geom.Geometry getUnion(java.util.ArrayList urbanAgentList)

urbanAgentContainsResidents

public java.util.ArrayList urbanAgentContainsResidents(boolean popdensityOff)

popDensity

public double popDensity(boolean popdensityOff)
initially there is a problems with rounding errors of % around 3% but this changes as the model developes. As these are characterised in the model. It is a problem as I am converting from a double to an int in determinpop Updates the population of the urban agent (shapefile) at each step and saves it to the shapefile dbf (assumes that the % of agents represents the actural population.

Parameters:
popdensityOff -

countResidentTypes

public static java.util.HashMap countResidentTypes(java.util.ArrayList residents)

percentageResidentTypes

public static java.util.HashMap percentageResidentTypes(java.util.ArrayList residents)