de.cesr.more.rs.geo.util
Class MGeographyWrapper<AgentType>

java.lang.Object
  extended by de.cesr.more.rs.geo.util.MGeographyWrapper<AgentType>
Type Parameters:
AgentType - The type of objects contained in the wrapped geography

public class MGeographyWrapper<AgentType>
extends Object

MoRe

Date:
22.07.2010

Field Summary
protected  MoreWithinQueryFactory<AgentType> queryFac
           
 
Constructor Summary
MGeographyWrapper(repast.simphony.space.gis.Geography<AgentType> geography)
           
 
Method Summary
<AreaType> AreaType
getContainingAreaContext(AgentType agent, Class<AreaType> areaClass)
           
<ReturnType>
int
getMaxNumAgents(Class<ReturnType> returnClass)
           
<ReturnType>
int
getMaxNumAgents(com.vividsolutions.jts.geom.Geometry area, Class<ReturnType> returnClass)
           
<ReturnType>
List<ReturnType>
getSurroundingAgents(AgentType focus, double radius, Class<? extends ReturnType> returnClass)
          Find agents who are next to the focal agent within the given maximum radius.
<ReturnType>
List<ReturnType>
getSurroundingNAgents(AgentType focus, int numAgents, double radius, Class<ReturnType> returnClass)
          Find agents who are next to the focal agent within the given area.
<ReturnType>
List<ReturnType>
getSurroundingNAgents(AgentType focus, int numAgents, com.vividsolutions.jts.geom.Geometry area, double radius, Class<ReturnType> returnClass)
          Find agents who are next to the focal agent within the given area.
 double getTotalArea(Collection<? extends Object> areaContexts)
          Sums up the area of every given area context within the geography associated with this MGeographyWrapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queryFac

protected MoreWithinQueryFactory<AgentType> queryFac
Constructor Detail

MGeographyWrapper

public MGeographyWrapper(repast.simphony.space.gis.Geography<AgentType> geography)
Parameters:
geography -
Method Detail

getSurroundingNAgents

public <ReturnType> List<ReturnType> getSurroundingNAgents(AgentType focus,
                                                           int numAgents,
                                                           com.vividsolutions.jts.geom.Geometry area,
                                                           double radius,
                                                           Class<ReturnType> returnClass)
Find agents who are next to the focal agent within the given area. Starting with a radius of radius the radius is expanded by radius until enough agents are found or the number of total objects within the geography is reached. Checks if the the number of all agents within the given area is larger or equal to the requested number.

Parameters:
focus -
numAgents -
area -
radius - radius to search agents within in meters
returnClass -
Returns:
Collection of agents in the area

getSurroundingNAgents

public <ReturnType> List<ReturnType> getSurroundingNAgents(AgentType focus,
                                                           int numAgents,
                                                           double radius,
                                                           Class<ReturnType> returnClass)
Find agents who are next to the focal agent within the given area. Starting with a radius of radius the radius is expanded by radius until enough agents are found or the number of total objects within the geography is reached.

Parameters:
focus -
numAgents -
radius - radius to search agents within in meters
returnClass -
Returns:
Collection of agents in the area

getSurroundingAgents

public <ReturnType> List<ReturnType> getSurroundingAgents(AgentType focus,
                                                          double radius,
                                                          Class<? extends ReturnType> returnClass)
Find agents who are next to the focal agent within the given maximum radius. Does not consider areas (AreaContext. Checks for return class.

Type Parameters:
ReturnType -
Parameters:
focus -
radius - radius to search agents within in meters
returnClass -
Returns:
list of surrounding agents

getMaxNumAgents

public <ReturnType> int getMaxNumAgents(com.vividsolutions.jts.geom.Geometry area,
                                        Class<ReturnType> returnClass)
Parameters:
area -
returnClass -
Returns:
sum of agents of type return type in area

getMaxNumAgents

public <ReturnType> int getMaxNumAgents(Class<ReturnType> returnClass)
Parameters:
returnClass -
Returns:
sum of agents of type return type in the entire geography

getContainingAreaContext

public <AreaType> AreaType getContainingAreaContext(AgentType agent,
                                                    Class<AreaType> areaClass)
Parameters:
geography -
agent -
Returns:

getTotalArea

public double getTotalArea(Collection<? extends Object> areaContexts)
Sums up the area of every given area context within the geography associated with this MGeographyWrapper.

Parameters:
areaContexts -
Returns:
entire area