uchicago.src.sim.space
Class HexNeighborhooder

java.lang.Object
  extended by uchicago.src.sim.space.AbstractNeighborhooder
      extended by uchicago.src.sim.space.HexNeighborhooder
All Implemented Interfaces:
Neighborhooder

public class HexNeighborhooder
extends AbstractNeighborhooder


Field Summary
 
Fields inherited from class uchicago.src.sim.space.AbstractNeighborhooder
comparator, space, torus
 
Constructor Summary
HexNeighborhooder(Discrete2DSpace space)
           
 
Method Summary
protected  void addXY(java.util.Vector v, int x, int y)
           
 java.util.Vector getNeighbors(int x, int y, boolean returnNull)
          Returns the ring of neighbors with a radius of 1 surrounding the cell at x, y.
 java.util.Vector getNeighbors(int x, int y, int[] extents, boolean returnNull)
          Returns the rings of neighbors surrounding the cell at x, y.
 
Methods inherited from class uchicago.src.sim.space.AbstractNeighborhooder
compareMax, compareMin, findMaximum, findMinimum, setComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HexNeighborhooder

public HexNeighborhooder(Discrete2DSpace space)
Method Detail

getNeighbors

public java.util.Vector getNeighbors(int x,
                                     int y,
                                     boolean returnNull)
Returns the ring of neighbors with a radius of 1 surrounding the cell at x, y.

Parameters:
x - the x coordinate of the cell
y - the y coordinate of the cell
Returns:
an array of doubles in clockwise order starting with the north or "12" neighboring cell

getNeighbors

public java.util.Vector getNeighbors(int x,
                                     int y,
                                     int[] extents,
                                     boolean returnNull)
Returns the rings of neighbors surrounding the cell at x, y. The number of rings is specified by the radius parameter.

Parameters:
x - the x coordinate of the cell
y - the y coordinate of the cell
extents - the number of neighbor rings to return
Returns:
an array of doubles beginning with the outermost ring of neighbors, starting with the north or "12 o'clock" neighboring cell, continuing clockwise and spiraling inwards

addXY

protected void addXY(java.util.Vector v,
                     int x,
                     int y)