|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.ucl.casa.andrew.phd.segregationModelDensity.Resident
This is the same basic class as with other residents however density has been added to the agents preferences.
Field Summary | |
(package private) double |
currentNeigbourhoodPopulationDenstiy
|
(package private) int |
gisResidentAgentIndex
|
(package private) boolean |
happy
|
(package private) static int |
idCounter
|
(package private) float |
movementOfResident
|
(package private) float |
movetoWithin
|
(package private) int |
noTimesMoved
|
(package private) com.bbn.openmap.omGraphics.OMCircle |
omCircle
Instance fields * |
(package private) static java.util.ArrayList |
removedResidentList
|
(package private) int |
residentAge
|
(package private) java.lang.String |
socclass
|
Constructor Summary | |
Resident(java.util.ArrayList urbanAgentList)
|
|
Resident(float lat,
float lon,
float radius,
java.lang.String socclass,
int resAge,
boolean happy)
|
Method Summary | |
void |
agePopulation()
|
void |
bigMovementForResident()
|
void |
calculateDistanceToAgentsOfSameType(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList,
float movetoWithin)
If the Agent is unhappy it moves. |
void |
calculateNeigbours(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList)
Caluculates the types of nighbousrs based on Social classs and uses the hashmap from the neighboursWithin method to do this. |
static java.util.HashMap |
countNeibourhingAgents(java.util.ArrayList residents)
Takes the parameter residents and caluclates The method returns a hashMap and is used in percentageOfNeibourhingAgents |
void |
evaluateAndSetHappiness(java.util.ArrayList residentsList,
java.util.ArrayList environmentAgentList)
Evaluates and sets the agents happyness based on its surrounding neighbourhood and the agents indervidial prefferences for differnet types of agents. |
ResidentArrayList |
findNearestNeighbourOfSameType(java.util.ArrayList residentsList)
If the Agent is unhappy it moves. |
int |
getAge()
|
java.awt.Paint |
getFillPaint()
|
com.vividsolutions.jts.geom.Geometry |
getGeometryResdient()
This method gets the lat & longeting of the omCircle (agents) goeometry and creates a new point for the agent which is then passed to the isInUnionGeometry method to check that the can move, see if each omCircle agent is within UrbanAgent bounding box. |
int |
getGisAgentIndex()
|
boolean |
getHappyness()
Gets the current agents Happyness (either true or false) |
float |
getLat()
|
com.bbn.openmap.LatLonPoint |
getLatLon()
|
float |
getLon()
|
int[] |
getNeighbors()
|
int |
getNumberOfTimesAgentMoved()
|
com.bbn.openmap.omGraphics.OMGraphic |
getOMGraphic()
|
float |
getRadius()
|
java.lang.String |
getsoc()
|
java.lang.String[] |
gisPropertyList()
|
boolean |
isInUnionGeometry(java.util.ArrayList urbanAgentsList)
Tests to see if resdient agent is within an urban agent which is used in stepRestrictTo method, the mthod takes the ArrayList from Urban Agent (therefore inherits all the properties from Urban agent (especially the union geoemtry)and uses it to see if the agent can move. |
void |
moveAgentUntilHappy(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList,
anl.repast.gis.display.OpenMapDisplay omDisplay,
float movetoWithin,
float movementOfResident)
This method will only move the agents that are unhappy, each agent is moved until it finds an area where it is happy to live. |
void |
movement(float movementOfResident)
Governs how far an agent can move in any time step, takes the SegGISModel.movement movement paremater as the distance for random movement in both X and Y Directions. |
void |
movementForNewResdient()
|
java.util.ArrayList |
neighboursWithin(java.util.ArrayList residentsList,
java.util.ArrayList environmentAgentList)
finds which resident agents are within a specified radius of a specific agent using a buffering mechansim from JTS. |
com.vividsolutions.jts.geom.Point |
newAgentAtCentrePoint(java.util.ArrayList urbanAgents)
This method creates a new point based on the centroid of the centroid of the area of interest. |
static int |
numberOfTimesAgentMoved()
|
static java.util.HashMap |
percentageOfNeibourhingAgents(java.util.ArrayList residentsList)
Takes the parameter residents and uses the method countNeibourhingAgents and is called in the calculateNeigbours method after summaryOfNeibourhingAgents has been called and caluclates the percentage of neighbours at a specific distance (buffer). |
void |
postStep(java.util.ArrayList residents,
java.util.ArrayList urbanAgentsList)
|
void |
preStep(java.util.ArrayList residents)
|
static int |
randomAge()
A simple method sets the resdinet agents age randomly between a min and max value |
static com.vividsolutions.jts.geom.Point |
randomPointforNewAgent(java.util.ArrayList urbanAgentList)
This method creates a new point for the agent to be placed randomly within the urban area using JTS CoordinateArrays class http://vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/CoordinateArrays.html The method first finds the max and min x and y values and creates a random new point between these values, and then checks to see if the agent is within the urban layer extent if not, a new random point is chosen until it returns true. |
void |
reallyBigBigMovementForResident()
|
void |
reallyBigMovementForResident()
|
static void |
reset()
|
void |
setAge(int residentAge)
|
void |
setGisAgentIndex(int index)
|
void |
setHappyness(boolean residentHappy)
Sets the current agents Happyness(either true or false) |
void |
setLat(float lat)
|
void |
setLatLon(float lat,
float lon)
|
void |
setLon(float lon)
|
void |
setNeighbors(int[] neighbours)
|
void |
setNumberOfTimesAgentMoved(int noTimesMoved)
|
void |
setOMGraphic(com.bbn.openmap.omGraphics.OMGraphic omg)
|
void |
setRadius(float newrad)
|
static java.lang.String |
setRandomSocialClass()
|
void |
setsoc(java.lang.String socialclass)
|
void |
smallMovementForNewResdient()
|
void |
step(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList,
anl.repast.gis.display.OpenMapDisplay omDisplay,
float movetoWithin,
float movementOfResident)
What the urban agents do in each time step, I have tried to to keep this simple, but it calls on a number of other methods Parameters taken include residents,ArrayList urbanAgents, OpenMapDisplay omDisplay, which are passed on from SegGISModel |
void |
stepRestrictTo(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList,
anl.repast.gis.display.OpenMapDisplay omDisplay)
Used to restrict movement of the agents within a shapefile. |
void |
stepRestrictToForNewResident(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentsList,
anl.repast.gis.display.OpenMapDisplay omDisplay,
float movetoWithin,
float movementOfResident)
To ensure that the current resedient is actually created the area of interest, once the resident agent has been created stepRestrictToForNewResident mehod is called. |
java.util.ArrayList |
summaryOfNeibourhingAgents(java.util.ArrayList residentsList,
java.util.ArrayList urbanAgentList)
Takes the parameter residents and caluclates the number of of neighbours at a specific distance (buffer) and is used in calculateNeigbours method. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
com.bbn.openmap.omGraphics.OMCircle omCircle
static int idCounter
static java.util.ArrayList removedResidentList
int gisResidentAgentIndex
int noTimesMoved
double currentNeigbourhoodPopulationDenstiy
java.lang.String socclass
float movementOfResident
int residentAge
boolean happy
float movetoWithin
Constructor Detail |
public Resident(float lat, float lon, float radius, java.lang.String socclass, int resAge, boolean happy)
public Resident(java.util.ArrayList urbanAgentList)
Method Detail |
public static void reset()
public void preStep(java.util.ArrayList residents)
public void step(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList, anl.repast.gis.display.OpenMapDisplay omDisplay, float movetoWithin, float movementOfResident)
residentsList
- urbanAgentsList
- omDisplay
- movetoWithin
- movementOfResident
- public void postStep(java.util.ArrayList residents, java.util.ArrayList urbanAgentsList)
residents
- urbanAgentsList
- public int getNumberOfTimesAgentMoved()
public void setNumberOfTimesAgentMoved(int noTimesMoved)
public static int numberOfTimesAgentMoved()
public void evaluateAndSetHappiness(java.util.ArrayList residentsList, java.util.ArrayList environmentAgentList)
residentsList
- environmentAgentList
- public com.vividsolutions.jts.geom.Point newAgentAtCentrePoint(java.util.ArrayList urbanAgents)
public static com.vividsolutions.jts.geom.Point randomPointforNewAgent(java.util.ArrayList urbanAgentList)
public void stepRestrictToForNewResident(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList, anl.repast.gis.display.OpenMapDisplay omDisplay, float movetoWithin, float movementOfResident)
residentsList
- urbanAgentsList
- omDisplay
- movetoWithin
- movementOfResident
- public void stepRestrictTo(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList, anl.repast.gis.display.OpenMapDisplay omDisplay)
residentsList
- urbanAgentsList
- omDisplay
- public ResidentArrayList findNearestNeighbourOfSameType(java.util.ArrayList residentsList)
residentsList
-
public void calculateDistanceToAgentsOfSameType(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList, float movetoWithin)
residentsList
- urbanAgentsList
- movetoWithin
- public void moveAgentUntilHappy(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList, anl.repast.gis.display.OpenMapDisplay omDisplay, float movetoWithin, float movementOfResident)
residentsList
- urbanAgentsList
- omDisplay
- movetoWithin
- movementOfResident
- public com.vividsolutions.jts.geom.Geometry getGeometryResdient()
public boolean isInUnionGeometry(java.util.ArrayList urbanAgentsList)
urbanAgentsList
-
public void movement(float movementOfResident)
movementOfResident
- public void smallMovementForNewResdient()
public void movementForNewResdient()
public void bigMovementForResident()
public void reallyBigMovementForResident()
public void reallyBigBigMovementForResident()
public void calculateNeigbours(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentsList)
residentsList
- urbanAgentsList
- public java.util.ArrayList neighboursWithin(java.util.ArrayList residentsList, java.util.ArrayList environmentAgentList)
residentsList
- environmentAgentList
-
public java.util.ArrayList summaryOfNeibourhingAgents(java.util.ArrayList residentsList, java.util.ArrayList urbanAgentList)
residentsList
- urbanAgentList
-
public static java.util.HashMap countNeibourhingAgents(java.util.ArrayList residents)
residents
-
public static java.util.HashMap percentageOfNeibourhingAgents(java.util.ArrayList residentsList)
residentsList
-
public boolean getHappyness()
public void setHappyness(boolean residentHappy)
public static int randomAge()
public int getAge()
public void setAge(int residentAge)
public void agePopulation()
public static java.lang.String setRandomSocialClass()
public float getLat()
public float getLon()
public com.bbn.openmap.LatLonPoint getLatLon()
public void setLatLon(float lat, float lon)
public float getRadius()
public void setRadius(float newrad)
public void setLat(float lat)
public void setLon(float lon)
public void setsoc(java.lang.String socialclass)
public java.lang.String getsoc()
public java.awt.Paint getFillPaint()
getFillPaint
in interface anl.repast.gis.OpenMapAgent
public com.bbn.openmap.omGraphics.OMGraphic getOMGraphic()
getOMGraphic
in interface anl.repast.gis.OpenMapAgent
public void setOMGraphic(com.bbn.openmap.omGraphics.OMGraphic omg)
setOMGraphic
in interface anl.repast.gis.OpenMapAgent
public int getGisAgentIndex()
getGisAgentIndex
in interface anl.repast.gis.GisAgent
public void setGisAgentIndex(int index)
setGisAgentIndex
in interface anl.repast.gis.GisAgent
public java.lang.String[] gisPropertyList()
gisPropertyList
in interface anl.repast.gis.GisAgent
public void setNeighbors(int[] neighbours)
setNeighbors
in interface anl.repast.gis.GisAgent
public int[] getNeighbors()
getNeighbors
in interface anl.repast.gis.GisAgent
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |