uchicago.src.sim.topology.space
Class AbstractNeighborhood

java.lang.Object
  extended byuchicago.src.sim.topology.space.AbstractNeighborhood
All Implemented Interfaces:
Neighborhood, RelationTopology
Direct Known Subclasses:
Hex3DNeighborhood, HexNeighborhood, Moore3DNeighborhood, MooreNeighborhood, VonNeumannNeighborhood, VonNeumannNeighborhood

public abstract class AbstractNeighborhood
extends java.lang.Object
implements Neighborhood, RelationTopology


Field Summary
protected  java.util.Comparator comparator
           
protected  int modCount
           
 
Constructor Summary
AbstractNeighborhood(java.lang.String type)
           
 
Method Summary
protected  java.util.List compareMax(java.util.List v)
           
protected  java.util.List compareMin(java.util.List v)
           
 java.util.List emptyLocations(Location location, int extent, boolean includeOrigin)
           
abstract  LocationIterator emptyLocationsIterator(Location location, int extent, boolean includeOrigin)
           
 java.util.List findMaximum(Location location, int extent, boolean includeOrigin)
           
 java.util.List findMinimum(Location location, int extent, boolean includeOrigin)
           
abstract  int getAgentCount(Location location, int extent, boolean includeOrigin)
           
abstract  int getNeighborhoodSize(Location location, int extent, boolean includeOrigin)
           
 java.util.List getRelations(java.lang.Object element, double range)
          Gets all of the Objects within a given range.
 java.lang.String getRelationType()
          Get the type of relationship/topology that is represented by this Class.
protected abstract  Space getSpace()
           
abstract  boolean isFull(Location location, int extent, boolean includeOrigin)
           
 java.util.List locations(Location location, int extent, boolean includeOrigin)
           
abstract  LocationIterator locationsIterator(Location location, int extent, boolean includeOrigin)
           
abstract  NeighborIterator neighborIterator(Location location, int extent, boolean includeOrigin)
           
 java.util.List neighbors(Location location, int extent, boolean includeOrigin)
           
 java.util.List occupiedLocations(Location location, int extent, boolean includeOrigin)
           
abstract  LocationIterator occupiedLocationsIterator(Location location, int extent, boolean includeOrigin)
           
 void setComparator(java.util.Comparator c)
           
 void setRelationType(java.lang.String type)
          Set the type of relationship/topology that is represented by this Class.
 
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.RelationTopology
distance
 

Field Detail

modCount

protected int modCount

comparator

protected java.util.Comparator comparator
Constructor Detail

AbstractNeighborhood

public AbstractNeighborhood(java.lang.String type)
Method Detail

neighbors

public java.util.List neighbors(Location location,
                                int extent,
                                boolean includeOrigin)
Specified by:
neighbors in interface Neighborhood

locations

public java.util.List locations(Location location,
                                int extent,
                                boolean includeOrigin)
Specified by:
locations in interface Neighborhood

emptyLocations

public java.util.List emptyLocations(Location location,
                                     int extent,
                                     boolean includeOrigin)
Specified by:
emptyLocations in interface Neighborhood

occupiedLocations

public java.util.List occupiedLocations(Location location,
                                        int extent,
                                        boolean includeOrigin)
Specified by:
occupiedLocations in interface Neighborhood

setComparator

public void setComparator(java.util.Comparator c)

findMaximum

public java.util.List findMaximum(Location location,
                                  int extent,
                                  boolean includeOrigin)
Specified by:
findMaximum in interface Neighborhood

findMinimum

public java.util.List findMinimum(Location location,
                                  int extent,
                                  boolean includeOrigin)
Specified by:
findMinimum in interface Neighborhood

compareMax

protected java.util.List compareMax(java.util.List v)

compareMin

protected java.util.List compareMin(java.util.List v)

getSpace

protected abstract Space getSpace()

isFull

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

getAgentCount

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

getNeighborhoodSize

public abstract int getNeighborhoodSize(Location location,
                                        int extent,
                                        boolean includeOrigin)
Specified by:
getNeighborhoodSize in interface Neighborhood

neighborIterator

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

locationsIterator

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

emptyLocationsIterator

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

occupiedLocationsIterator

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

getRelations

public java.util.List getRelations(java.lang.Object element,
                                   double range)
Description copied from interface: RelationTopology
Gets all of the Objects within a given range.

Specified by:
getRelations in interface RelationTopology
Parameters:
element -
range -
Returns:

getRelationType

public java.lang.String getRelationType()
Get the type of relationship/topology that is represented by this Class. This can be controlled so that two objects of the same class can exist in the context with different type id's. For example, if this represents a Object3DGrid, this could return "Agent Space" or "Playing Field".

Specified by:
getRelationType in interface RelationTopology
Returns:
the type

setRelationType

public void setRelationType(java.lang.String type)
Set the type of relationship/topology that is represented by this Class. This can be controlled so that two objects of the same class can exist in the context with different type id's. For example, if this represents a Object3DGrid, this could return "Agent Space" or "Playing Field".

Specified by:
setRelationType in interface RelationTopology
Parameters:
type -
See Also:
RelationTopology.setRelationType(java.lang.String)