|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcrowdmodel.utils.Misc
public class Misc
Class that describes static method functions = functions that do not need a class instantiation to be used = functions that are convenient for my model, however are not part of the model These involve functions that describe perception functions like the agents that can be perceived by an individual, or to check whether a position is walkable or not, functions to initialise the social structure etc.
Constructor Summary | |
---|---|
Misc()
|
Method Summary | |
---|---|
static java.util.Vector<CrowdAgent> |
agentsInCone(repast.simphony.context.Context context,
CrowdAgent me,
double angle,
double distance)
Returns the agents that are situated in a cone given a position, angle, width and depth. |
static java.lang.String |
bName2fName(java.lang.String behaviourName)
Given a behaviourName the corresponding factName is returned. |
static boolean |
close2friend(repast.simphony.context.Context<CObject> context,
java.util.Iterator<CrowdAgent> friends,
CrowdAgent me)
This function returns whether an agent is standing close to one of its friends This is done by checking the distance between the agent and all of its friends. |
static int[][] |
createGroup(int[][] matrix,
int groupsize,
int numgroups,
int crowdsize)
Function creates a matrix that represents a social structure. |
static boolean |
crowded(repast.simphony.space.continuous.ContinuousSpace space,
repast.simphony.space.continuous.NdPoint point,
double dist)
|
static java.lang.Integer |
crowdedness(repast.simphony.space.continuous.ContinuousSpace space,
repast.simphony.space.continuous.NdPoint point,
double dist)
|
static boolean |
crowdedOld(repast.simphony.space.continuous.ContinuousSpace space,
repast.simphony.space.continuous.NdPoint point)
Indicated whether a point is crowded based on the occupancy of the 8 surrounding patches (Moore's neighbourhood). |
static java.util.ArrayList<java.lang.String> |
fill(java.lang.String[] list)
Converts an String array into an ArrayList Used by the behaviourRules classes |
static repast.simphony.space.grid.GridPoint |
findWalkableNeighborPatch(repast.simphony.context.Context<CObject> context,
repast.simphony.space.grid.GridPoint pos)
|
static java.lang.String |
fName2bName(java.lang.String factName)
Given a factName the corresponding behaviourtName is returned. |
static int |
getDensityCondition(int crowdsize)
|
static int |
getLeadershipCondition(int leaderRatio)
|
static java.util.Vector<repast.simphony.space.grid.GridPoint> |
getMooresPatches(repast.simphony.space.grid.GridPoint gp)
|
static int |
getSafetyCondition(java.lang.String distribution)
Relates the safety condition with a number. 1 = friends (crowd composition) = low preference safety goal = B(3,7) 2 = mixed (crowd composition) = average preference safety goal = B(5,5) 3 = family (crowd composition) = high preference safety goal = B(7,3) |
static double |
heading2point(repast.simphony.space.continuous.NdPoint pos,
repast.simphony.space.continuous.NdPoint poi)
Calculates what the new heading should be, given a point it should be directed to In repast the coordinate system goes from 0 (top), 90 (right), 180/-180 (bottom), -90 (left). |
static java.util.ArrayList |
iterator2array(java.util.Iterator iterator,
int size)
|
static int[][] |
makeFriends(int crowdsize,
int duoPerc,
int trioPerc,
int quartetPerc)
The function makeFriends defines the initial social structure. |
static void |
matrixPrint(double[][] matrix)
Prints a matrix on the console - overloading function depending on the type of matrix here a matrix filled with Double values |
static void |
matrixPrint(int[][] matrix)
Prints a matrix on the console, specificly a matrix for friends with the first row being printed outside the matrix... |
static repast.simphony.space.grid.GridPoint |
nd2gridpoint(repast.simphony.space.continuous.NdPoint target)
Returns the corresponding patch that a NdPoint belongs to (this is of course a approximation, as we use a rounding function for the double coordinate values to return an integer coordinate value) |
static CrowdAgent |
nearestAgent(repast.simphony.context.Context context,
CrowdAgent me,
java.util.Iterator<CrowdAgent> agents)
Returns the agent that is physically the nearest |
static int |
nrAgentsInCone(repast.simphony.context.Context context,
CrowdAgent me,
double angle,
double distance)
Calculates the number of agents that are situated in a cone given a position, angle, depth and width. |
static repast.simphony.space.continuous.NdPoint |
posClose2pos(repast.simphony.context.Context<CObject> context,
repast.simphony.space.continuous.NdPoint posFriend,
CrowdAgent me)
Function returns a position close a given position (here the position of a friend is used) It searches for a position in the Moore's neighbourhood (the eight surrounding patches) When no position can be found in the neighbourhood that is available for an agent to stand on (depending on walkablility: occupiedness (other objects/agents) and positioned within the world) the function returns null. |
static repast.simphony.space.continuous.NdPoint |
posNearestAgent(repast.simphony.context.Context context,
repast.simphony.space.continuous.NdPoint myPos,
java.util.Iterator<CrowdAgent> agents,
CrowdAgent me)
Returns the location of the nearest positioned agent given a set of agents and my own position. |
static void |
setSocialNetwork(repast.simphony.context.Context agentContext,
int[][] links)
Sets the initial social structure in the repast context in terms of a Network projection. |
static boolean |
walkablePatch(repast.simphony.context.Context context,
CrowdAgent thisAgent,
repast.simphony.space.continuous.NdPoint target)
Given a (x,y) coordinate this function returns whether this gridcell is walkable or not based on the position being located within the world and whether the cell is walkable (not a building (stage,bar,toilet)) Note overloaded function! |
static boolean |
walkablePatch(repast.simphony.context.Context context,
repast.simphony.space.grid.GridPoint target)
Given a GridPoint (x,y) coordinate this function returns whether this gridcell is walkable or not (so if CellObjects are on it) Note verloaded function! |
static boolean |
withinWorld(repast.simphony.space.grid.GridPoint target)
Indicates whether a GridPoint lies within the world |
static boolean |
withinWorld(repast.simphony.space.continuous.NdPoint target)
Indicates whether a NdPoint lies within the world or not |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Misc()
Method Detail |
---|
public static java.util.ArrayList<java.lang.String> fill(java.lang.String[] list)
public static int nrAgentsInCone(repast.simphony.context.Context context, CrowdAgent me, double angle, double distance)
public static boolean crowdedOld(repast.simphony.space.continuous.ContinuousSpace space, repast.simphony.space.continuous.NdPoint point)
space
- point
-
public static boolean crowded(repast.simphony.space.continuous.ContinuousSpace space, repast.simphony.space.continuous.NdPoint point, double dist)
public static java.lang.Integer crowdedness(repast.simphony.space.continuous.ContinuousSpace space, repast.simphony.space.continuous.NdPoint point, double dist)
public static java.util.Vector<CrowdAgent> agentsInCone(repast.simphony.context.Context context, CrowdAgent me, double angle, double distance)
public static repast.simphony.space.continuous.NdPoint posNearestAgent(repast.simphony.context.Context context, repast.simphony.space.continuous.NdPoint myPos, java.util.Iterator<CrowdAgent> agents, CrowdAgent me)
myPos
- - the position of the agent who is concerned with the distance of other agentsagents
- - set of agents that I want to extract the position of the nearest person
public static CrowdAgent nearestAgent(repast.simphony.context.Context context, CrowdAgent me, java.util.Iterator<CrowdAgent> agents)
myPos
- - the position of the agent who is concerned with the distance of other agentsagents
- - set of agents that I want to extract the position of the nearest person
public static boolean withinWorld(repast.simphony.space.grid.GridPoint target)
target
-
public static boolean withinWorld(repast.simphony.space.continuous.NdPoint target)
target
-
public static boolean walkablePatch(repast.simphony.context.Context context, CrowdAgent thisAgent, repast.simphony.space.continuous.NdPoint target)
px
- py
- sspace
-
public static java.util.Vector<repast.simphony.space.grid.GridPoint> getMooresPatches(repast.simphony.space.grid.GridPoint gp)
public static boolean walkablePatch(repast.simphony.context.Context context, repast.simphony.space.grid.GridPoint target)
px
- py
- sspace
-
public static double heading2point(repast.simphony.space.continuous.NdPoint pos, repast.simphony.space.continuous.NdPoint poi)
pos
- - my posistion (A)poi
- - position I want to set my heading towards (B)public static repast.simphony.space.grid.GridPoint nd2gridpoint(repast.simphony.space.continuous.NdPoint target)
target
-
public static int[][] makeFriends(int crowdsize, int duoPerc, int trioPerc, int quartetPerc)
crowdsize
- duoPerc
- trioPerc
- quartetPerc
-
public static int[][] createGroup(int[][] matrix, int groupsize, int numgroups, int crowdsize)
matrix
- groupsize
- numgroups
- crowdsize
-
public static void matrixPrint(int[][] matrix)
matrix
- public static void matrixPrint(double[][] matrix)
matrix
- public static void setSocialNetwork(repast.simphony.context.Context agentContext, int[][] links)
agentContext
- links
- public static boolean close2friend(repast.simphony.context.Context<CObject> context, java.util.Iterator<CrowdAgent> friends, CrowdAgent me)
context
- friends
- myPos
-
public static repast.simphony.space.continuous.NdPoint posClose2pos(repast.simphony.context.Context<CObject> context, repast.simphony.space.continuous.NdPoint posFriend, CrowdAgent me)
context
- posFriend
- me
-
public static repast.simphony.space.grid.GridPoint findWalkableNeighborPatch(repast.simphony.context.Context<CObject> context, repast.simphony.space.grid.GridPoint pos)
context
- pos
-
public static java.lang.String bName2fName(java.lang.String behaviourName)
behaviourName
-
public static java.lang.String fName2bName(java.lang.String factName)
factName
-
public static java.util.ArrayList iterator2array(java.util.Iterator iterator, int size)
public static int getDensityCondition(int crowdsize)
public static int getSafetyCondition(java.lang.String distribution)
distribution
-
public static int getLeadershipCondition(int leaderRatio)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |