## org.ascape.model.space
Class Array2DVonNeumann

    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
                          org.ascape.model.space.Array2DVonNeumann

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

    public class Array2DVonNeumann

extends Array2D

A two-dimensional space providing effecient implementations for von Neumann neighbors. In a von Neumann neighborhood, cells are considered neighbors if they share a side with the target:

     O
     OXO
     O

Since:
  1.0
Version:
  2.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

Fields inherited from class org.ascape.model.space.Array2D
`MAX_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
`Array2DVonNeumann()` Constructs a two-dimensional von Neumann array.
`Array2DVonNeumann(CoordinateDiscrete extent)` Constructs a two-dimensional von Neumann array.

Method Summary
`double` `calculateDistance(Coordinate origin, Coordinate target)` Returns the shortest distance between one cell and the other.
`Node` `findCellAway(Node originCell, Node targetCell)` Returns the cell within immediate neighborhood furthest away from the requestd cell.
`Node` `findCellToward(Node originCell, Node targetCell)` Returns the next cell within immediate neighborhood toward the requested cell.
`java.util.List` `findWithinImpl(Coordinate origin, boolean includeSelf, double distance)` Returns cells that are near the provided coordinate.

Methods inherited from class org.ascape.model.space.Array2D
`calculateDistanceMoore, countWithin, findFirstMatchInRank, findNearest, findNearestMatchRank, findRandomMatchInRank, getNumOfCoordinatesWithinRank, getXSpan, getYSpan, hasWithin, initialize`

Methods inherited from class org.ascape.model.space.Array2DBase

`add, addAll, clear, clone, construct, contains, containsAll, findCells, findCells, 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, replace, swap`

Methods inherited from class org.ascape.model.space.Discrete

`bfsWithinIterator, 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`

Constructor Detail

### Array2DVonNeumann

    public Array2DVonNeumann()

  Constructs a two-dimensional von Neumann array.

### Array2DVonNeumann

    public Array2DVonNeumann(CoordinateDiscrete extent)

  Constructs a two-dimensional von Neumann array.

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

Method Detail

### findCellToward

    public Node findCellToward(Node originCell,
                               Node targetCell)

  Returns the next cell within immediate neighborhood toward the requested cell.

  Overrides:
    `findCellToward` in class `Array2DBase`
  Parameters:
    `originCell` - the current cell
    `targetCell` - the cell that we are moving toward
  Returns:
    the node

### findCellAway

    public Node findCellAway(Node originCell,
                             Node targetCell)

  Returns the cell within immediate neighborhood furthest away from the requestd cell.

  Overrides:
    `findCellAway` in class `Array2DBase`
  Parameters:
    `originCell` - the current cell
    `targetCell` - the cell that we are moving toward
  Returns:
    the node

### findWithinImpl

    public java.util.List findWithinImpl(Coordinate origin,
                                         boolean includeSelf,
                                         double distance)

  Description copied from class: `Array`
  Returns cells that are near the provided coordinate.

  Specified by:
    `findWithinImpl` in class `Array`
  Parameters:
    `origin` - the agent to find cells near
    `includeSelf` - should supplied agent be included in the return set
    `distance` - the distance to form centralCells to return cells
  Returns:
    the list

### calculateDistance

    public double calculateDistance(Coordinate origin,
                                    Coordinate target)

  Returns the shortest distance between one cell and the other. In a von Neumann neighborhood, this distance is equal to the sum of each dimension distance, unless nearnessIsLineOfSight is true, in which case, the distance is equal to the distance along an axis if the origin and target share an axis, and infinite (max value) otherwise. That is, nearnessIsLineOfSight interpets distance as the 'perceived' distance, while nearnessIsLineOfSight false interprest distance as the actual walking distance between two points.

  Specified by:
    `calculateDistance` in interface `Space`
  Overrides:
    `calculateDistance` in class `Discrete`
  Parameters:
    `origin` - the origin
    `target` - the target
  Returns:
    the double