Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ascape.model.space
Class Array2D

    java.lang.Object
      org.ascape.model.space.CollectionSpace
          org.ascape.model.space.Discrete
              org.ascape.model.space.Array
                  org.ascape.model.space.Array2DBase
                      org.ascape.model.space.Array2D

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, Relative, Space, RandomFunctions

Direct Known Subclasses:
  Array2DEuclidian, Array2DMoore, Array2DSmallWorld, Array2DVonNeumann

    public abstract class Array2D

extends Array2DBase

A two-dimensional, fixed-size collection of agents providing services described for space. Important: at moment, does not support von Neumann or Moore space for find near, uses Euclidian distances only.

Since:
  1.0
Version:
  3.0
Author:
  Miles Parker
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.ascape.model.space.CollectionSpace
`CollectionSpace.ClosestDataPoint, CollectionSpace.ConditionalIterator, CollectionSpace.CSIterator, CollectionSpace.CSMutableIterator, CollectionSpace.ListMutableRandomIterator, CollectionSpace.ListRandomIterator, CollectionSpace.MutableSubIterator, CollectionSpace.SubIterator`

Field Summary
`static int` | `MAX_RANK` The MA x_ RANK.

Fields inherited from class org.ascape.model.space.Array2DBase
`cells, currentPositionInRank, currentRank, nearnessLineOfSight, order, rankLimit, relativeCoordinates, relativeCoordinatesRankDistance, relativeCoordinatesRankLengths, relativeCoordinatesTemplate, sumOfCoordinatesWithinRank`

Fields inherited from class org.ascape.model.space.Array
`CACHE_RESULTS`

Fields inherited from class org.ascape.model.space.Discrete
`performanceWarning`

Fields inherited from class org.ascape.model.space.CollectionSpace
`collection, ESTIMATED_MAXIMUM_SIZE, extent, geometry`

Constructor Summary
`Array2D()` Constructs a 2-dimensional array space of provided extent.
`Array2D(Geometry geometry, CoordinateDiscrete extent)` Constructs a 2-dimensional array space of provided extent.

Method Summary
`double` | `calculateDistanceMoore(Coordinate origin, Coordinate target)` Calculate distance moore.
`int` | `countWithin(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)` Returns the number of cells within the supplied distance that meet the supplied condition.
`Location` | `findFirstMatchInRank(Coordinate origin, Conditional condition, int rank)` Returns the first element in the supplied rank that matches the supplied condition, null if no matches.
`Location` | `findNearest(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)` Finds the nearest cell that meets some condition.
`int` | `findNearestMatchRank(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)` Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches.
`Location` | `findRandomMatchInRank(Coordinate origin, Conditional condition, int rank)` Returns a random element in the supplied rank that matches the supplied condition, null if no matches.
`protected static int` | `getNumOfCoordinatesWithinRank(int rank)` Returns the number of relative coordiantes that exist in the given distance rank.
`protected int` | `getXSpan(Coordinate origin, Coordinate target)` Gets the x span.
`protected int` | `getYSpan(Coordinate origin, Coordinate target)` Gets the y span.
`boolean` | `hasWithin(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)` Returns true if there is a cell within the supplied distance that meets the supplied condition.
`void` | `initialize()` Initializes the space, copying a set of relative coordinates for use, and ensuring that the ordering used for random draws starts consistently.

Methods inherited from class org.ascape.model.space.Array2DBase
`add, addAll, clear, clone, construct, contains, containsAll, findCellAway, findCells, findCells, findCellToward, findRandom, findRandom, findRandom, findRandomCoordinate, findRandomRelative, findRandomUnoccupied, findRelative, findWithinEuclidian, findWithinMoore, findWithinVonNeumann, findWithinVonNeumannLineOfSight, findWithinVonNeumannMovement, get, get, getCellsNearVonNeumannLineOfSight, getCellsNearVonNeumannMovement, getSize, getXSize, getYSize, isEmpty, isMutable, isNearnessLineOfSight, isValid, isValid, iterator, populate, randomizeCallingOrder, randomizeRank, remove, removeAll, retainAll, safeIterator, safeIterator, safeRandomIterator, set, set, setExtent, setExtent, setGeometry, setNearnessLineOfSight, size, toArray, toArray, toList`

Methods inherited from class org.ascape.model.space.Array
`findWithin, findWithinImpl, replace, swap`

Methods inherited from class org.ascape.model.space.Discrete
`bfsWithinIterator, calculateDistance, calculateDistance, calculateNeighbors, findAvailable, findAvailable, findCellAwayBFS, findCellTowardBFS, findNearestAvailable, findNearestBFS, findNeighbors, findOccupants, findOccupants, findRandomAvailable, findRandomAvailable, findRandomAvailable, findRandomAvailableNeighbor, findRandomNeighbor, findRandomNeighbor, findRandomUnoccupiedCell, findRandomUnoccupiedCell, findWithinDefault, getCells, getCellsNearDefault, getDistance, getMaximumRank`

Methods inherited from class org.ascape.model.space.CollectionSpace
`add, calculateDistance, conditionalIterator, conditionalIterator, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandomWithin, getContext, getExtent, getGeometry, getRandom, isDeleteSweepNeeded, isPeriodic, iteratorCount, iteratorToList, moveAway, moveToward, newLocation, newLocation, randomInRange, randomInRange, randomIs, randomizeOrder, randomToLimit, safeIterators, setContext, setExtent, setPeriodic, setRandom, setSize, withinIterator`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.Collection
`equals, hashCode`

Field Detail

### MAX_RANK

    public static int MAX_RANK

  The MA x_ RANK.

Constructor Detail

### Array2D

    public Array2D()

  Constructs a 2-dimensional array space of provided extent.

### Array2D

    public Array2D(Geometry geometry,
                   CoordinateDiscrete extent)

  Constructs a 2-dimensional array space of provided extent.

  Parameters:
    `geometry` - geometry describing this space
    `extent` - a coordinate describing the size of this space

Method Detail

### initialize

    public void initialize()

  Initializes the space, copying a set of relative coordinates for use, and ensuring that the ordering used for random draws starts consistently.

  Specified by:
    `initialize` in interface `Space`
  Overrides:
    `initialize` in class `Array2DBase`

### getNumOfCoordinatesWithinRank

    protected static int getNumOfCoordinatesWithinRank(int rank)

  Returns the number of relative coordiantes that exist in the given distance rank.

  Parameters:
    `rank` - the rank to return coordinate count for
  Returns:
    the num of coordinates within rank

### calculateDistanceMoore

    public final double calculateDistanceMoore(Coordinate origin,
                                               Coordinate target)

  Calculate distance moore.

  Parameters:
    `origin` - the origin
    `target` - the target
  Returns:
    the double

### getXSpan

    protected final int getXSpan(Coordinate origin,
                                 Coordinate target)

  Gets the x span.

  Parameters:
    `origin` - the origin
    `target` - the target
  Returns:
    the x span

### getYSpan

    protected final int getYSpan(Coordinate origin,
                                 Coordinate target)

  Gets the y span.

  Parameters:
    `origin` - the origin
    `target` - the target
  Returns:
    the y span

### findFirstMatchInRank

    public Location findFirstMatchInRank(Coordinate origin,
                                         Conditional condition,
                                         int rank)

  Returns the first element in the supplied rank that matches the supplied condition, null if no matches.

  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `rank` - the rank to return match in
  Returns:
    the location

### findNearest

    public Location findNearest(Coordinate origin,
                                Conditional condition,
                                boolean includeOrigin,
                                double distance)

  Finds the nearest cell that meets some condition.

  Specified by:
    `findNearest` in interface `Space`
  Overrides:
    `findNearest` in class `Array`
  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `includeOrigin` - should supplied agent be included in the search
    `distance` - the maximum distance to search within
  Returns:
    the location

### findNearestMatchRank

    public int findNearestMatchRank(Coordinate origin,
                                    Conditional condition,
                                    boolean includeOrigin,
                                    double maximumDistance)

  Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches.

  Specified by:
    `findNearestMatchRank` in class `Array`
  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `includeOrigin` - should supplied agent (rank 0) be included in the search
    `maximumDistance` - the maximum distance to search within
  Returns:
    the int

### findRandomMatchInRank

    public Location findRandomMatchInRank(Coordinate origin,
                                          Conditional condition,
                                          int rank)

  Returns a random element in the supplied rank that matches the supplied condition, null if no matches.

  Specified by:
    `findRandomMatchInRank` in class `Array`
  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `rank` - the rank to return match in
  Returns:
    the location

### hasWithin

    public boolean hasWithin(Coordinate origin,
                             Conditional condition,
                             boolean includeOrigin,
                             double maximumDistance)

  Returns true if there is a cell within the supplied distance that meets the supplied condition.

  Specified by:
    `hasWithin` in interface `Space`
  Overrides:
    `hasWithin` in class `CollectionSpace`
  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `includeOrigin` - should supplied agent be included in the search
    `maximumDistance` - the distance to search within
  Returns:
    true, if has within

### countWithin

    public int countWithin(Coordinate origin,
                           Conditional condition,
                           boolean includeOrigin,
                           double maximumDistance)

  Returns the number of cells within the supplied distance that meet the supplied condition.

  Specified by:
    `countWithin` in interface `Space`
  Overrides:
    `countWithin` in class `CollectionSpace`
  Parameters:
    `origin` - the agent to find cells near
    `condition` - the condition that found cell must meet
    `includeOrigin` - should supplied agent be included in the search
    `maximumDistance` - the distance to search within
  Returns:
    the int

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD