uchicago.src.sim.topology.space.d3
Class Moore3DNeighborhood

java.lang.Object
  extended byuchicago.src.sim.topology.space.AbstractNeighborhood
      extended byuchicago.src.sim.topology.space.d3.Moore3DNeighborhood
All Implemented Interfaces:
Neighborhood, RelationTopology

public class Moore3DNeighborhood
extends AbstractNeighborhood
implements Neighborhood


Field Summary
protected  org.apache.commons.logging.Log log
           
protected  Object3DSpace space
           
 
Fields inherited from class uchicago.src.sim.topology.space.AbstractNeighborhood
comparator, modCount
 
Constructor Summary
Moore3DNeighborhood(Object3DSpace space)
           
Moore3DNeighborhood(java.lang.String type, Object3DSpace space)
           
 
Method Summary
 double distance(java.lang.Object element1, java.lang.Object element2)
          Gets the distance between two objects in this topology.
 LocationIterator emptyLocationsIterator(Location location, int extent, boolean includeOrigin)
           
 int getAgentCount(Location location, int extent, boolean includeOrigin)
           
 int getNeighborhoodSize(Location location, int extent, boolean includeOrigin)
          This method actually uses the following calculation to determine the number of cells included in a neighborhood
protected  Space getSpace()
           
 boolean isFull(Location location, int extent, boolean includeOrigin)
           
 LocationIterator locationsIterator(Location location, int extent, boolean includeOrigin)
           
 NeighborIterator neighborIterator(Location location, int extent, boolean includeOrigin)
           
 LocationIterator occupiedLocationsIterator(Location location, int extent, boolean includeOrigin)
           
 
Methods inherited from class uchicago.src.sim.topology.space.AbstractNeighborhood
compareMax, compareMin, emptyLocations, findMaximum, findMinimum, getRelations, getRelationType, locations, neighbors, occupiedLocations, setComparator, setRelationType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.topology.space.Neighborhood
emptyLocations, findMaximum, findMinimum, locations, neighbors, occupiedLocations
 

Field Detail

space

protected Object3DSpace space

log

protected org.apache.commons.logging.Log log
Constructor Detail

Moore3DNeighborhood

public Moore3DNeighborhood(java.lang.String type,
                           Object3DSpace space)

Moore3DNeighborhood

public Moore3DNeighborhood(Object3DSpace space)
Method Detail

getSpace

protected Space getSpace()
Specified by:
getSpace in class AbstractNeighborhood

distance

public double distance(java.lang.Object element1,
                       java.lang.Object element2)
Description copied from interface: RelationTopology
Gets the distance between two objects in this topology. This could be either spatial distance, network distance or any other kind of well defined metric distance.

Specified by:
distance in interface RelationTopology
Parameters:
element1 -
element2 -
Returns:

getNeighborhoodSize

public int getNeighborhoodSize(Location location,
                               int extent,
                               boolean includeOrigin)
This method actually uses the following calculation to determine the number of cells included in a neighborhood. (2n + 1)^2 RePast calculates neighs using 1 as the first set (not including the origin cell. I deal with this by adding one to the extent to calabrate it with RePast and subtracting 1 from final calculation to exclude the center cell.

Specified by:
getNeighborhoodSize in interface Neighborhood
Specified by:
getNeighborhoodSize in class AbstractNeighborhood
Parameters:
extent -
Returns:
the number of cells in the neghborhood
See Also:
uchicago.src.sim.topology.space.neighborhood.Neighborhood#getNeighborhoodSize(int, int)

isFull

public boolean isFull(Location location,
                      int extent,
                      boolean includeOrigin)
Specified by:
isFull in interface Neighborhood
Specified by:
isFull in class AbstractNeighborhood

getAgentCount

public int getAgentCount(Location location,
                         int extent,
                         boolean includeOrigin)
Specified by:
getAgentCount in interface Neighborhood
Specified by:
getAgentCount in class AbstractNeighborhood

neighborIterator

public NeighborIterator neighborIterator(Location location,
                                         int extent,
                                         boolean includeOrigin)
Specified by:
neighborIterator in interface Neighborhood
Specified by:
neighborIterator in class AbstractNeighborhood

locationsIterator

public LocationIterator locationsIterator(Location location,
                                          int extent,
                                          boolean includeOrigin)
Specified by:
locationsIterator in interface Neighborhood
Specified by:
locationsIterator in class AbstractNeighborhood

emptyLocationsIterator

public LocationIterator emptyLocationsIterator(Location location,
                                               int extent,
                                               boolean includeOrigin)
Specified by:
emptyLocationsIterator in interface Neighborhood
Specified by:
emptyLocationsIterator in class AbstractNeighborhood

occupiedLocationsIterator

public LocationIterator occupiedLocationsIterator(Location location,
                                                  int extent,
                                                  boolean includeOrigin)
Specified by:
occupiedLocationsIterator in interface Neighborhood
Specified by:
occupiedLocationsIterator in class AbstractNeighborhood