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

java.lang.Object
  extended by 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

Nested Class Summary
protected  class MGeoHexagon.Distance
           
 
Field Summary
protected  ArrayList<AgentType> agents
           
protected  TreeSet<MGeoHexagon.Distance> distanceHexagon
           
protected  Map<MGeoHexagon<AgentType>,Double> hexagonDistance
           
protected static double hexagonHeight
           
protected  int id
           
protected static int idCounter
           
 
Constructor Summary
MGeoHexagon()
          Assign unique id.
 
Method Summary
 void addAgent(AgentType agent)
           
 int compareTo(MGeoHexagon<AgentType> hexagon)
           
 boolean equals(Object o)
           
 ArrayList<AgentType> getAgents()
           
 double getDistance(MGeoHexagon<AgentType> hexagon)
           
 Set<MGeoHexagon<AgentType>> getHexagonsOfDistance(double distance)
           
 int getId()
           
 int hashCode()
           
 void setDistance(MGeoHexagon<AgentType> hexagon, Double distance)
           
static void setHexagonHeight(double height)
          The hexagon height is required to determine the distances
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

MGeoHexagon

public MGeoHexagon()
Assign unique id.

Method Detail

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()