de.cesr.more.rs.geo.util
Class MGeoHexagon<AgentType>
java.lang.Object
de.cesr.more.rs.geo.util.MGeoHexagon<AgentType>
- All Implemented Interfaces:
- Comparable<MGeoHexagon<AgentType>>
public class MGeoHexagon<AgentType>
- extends Object
- implements Comparable<MGeoHexagon<AgentType>>
MORe
The class represents hexagons of the model region that are used to group agents in to clusters of near-by instances
to ease computation of distances between agents. It also holds an ArrayList
of all agents within the
particular hexagon.
- Date:
- 21.06.2013
hexagonHeight
protected static double hexagonHeight
idCounter
protected static int idCounter
id
protected int id
agents
protected ArrayList<AgentType> agents
hexagonDistance
protected Map<MGeoHexagon<AgentType>,Double> hexagonDistance
distanceHexagon
protected TreeSet<MGeoHexagon.Distance> distanceHexagon
MGeoHexagon
public MGeoHexagon()
- Assign unique id.
setHexagonHeight
public static void setHexagonHeight(double height)
- The hexagon height is required to determine the distances
- Parameters:
height
-
getId
public int getId()
- Returns:
- hexagon's ID
addAgent
public void addAgent(AgentType agent)
- Parameters:
agent
- within the hexagon
getAgents
public ArrayList<AgentType> getAgents()
- Returns:
- list of agents within this hexagon
setDistance
public void setDistance(MGeoHexagon<AgentType> hexagon,
Double distance)
- Parameters:
hexagon
- distance
-
getDistance
public double getDistance(MGeoHexagon<AgentType> hexagon)
- Parameters:
hexagon
-
- Returns:
getHexagonsOfDistance
public Set<MGeoHexagon<AgentType>> getHexagonsOfDistance(double distance)
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
- See Also:
Object.hashCode()
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
- See Also:
Object.equals(java.lang.Object)
compareTo
public int compareTo(MGeoHexagon<AgentType> hexagon)
- Specified by:
compareTo
in interface Comparable<MGeoHexagon<AgentType>>
- See Also:
Comparable.compareTo(java.lang.Object)
toString
public String toString()
- Overrides:
toString
in class Object
- See Also:
Object.toString()