## org.ascape.model.space
Class Array

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

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

Direct Known Subclasses:
  Array2DBase, ListBase

    public abstract class Array

extends Discrete

The Class Array.

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 boolean` `CACHE_RESULTS` The Constant 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
`Array()` Constructs an array space.
`Array(CoordinateDiscrete extent)` Constructs an array space of provided extent.

Method Summary
`Location` `findNearest(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)` Finds the nearest cell that meets some condition.
`abstract 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.
`abstract 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.
`java.util.List` `findWithin(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)` Returns cells that are near the provided coordinate.
`protected abstract java.util.List` `findWithinImpl(Coordinate origin, boolean includeOrigin, double distance)` Returns cells that are near the provided coordinate.
`void` `replace(Node currentCell, Node newCell)` Changes the agent at the foirmer cells location to the supplied cell.
`void` `swap(Node one, Node two)` Swaps two cells in the graph.

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

`bfsWithinIterator, calculateDistance, calculateDistance, calculateNeighbors, findAvailable, findAvailable, findCellAway, findCellAwayBFS, findCellToward, findCellTowardBFS, findNearestAvailable, findNearestBFS, findNeighbors, findOccupants, findOccupants, findRandomAvailable, findRandomAvailable, findRandomAvailable, findRandomAvailableNeighbor, findRandomNeighbor, findRandomNeighbor, findRandomUnoccupiedCell, findRandomUnoccupiedCell, findWithinDefault, getCells, getCellsNearDefault, getDistance, getMaximumRank, getSize`

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

`add, add, addAll, calculateDistance, clear, clone, conditionalIterator, conditionalIterator, construct, contains, containsAll, countWithin, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandom, findRandomCoordinate, findRandomWithin, get, getContext, getExtent, getGeometry, getRandom, hasWithin, initialize, isDeleteSweepNeeded, isEmpty, isMutable, isPeriodic, iterator, iteratorCount, iteratorToList, moveAway, moveToward, newLocation, newLocation, populate, randomInRange, randomInRange, randomIs, randomizeOrder, randomToLimit, remove, removeAll, retainAll, safeIterator, safeIterator, safeIterators, safeRandomIterator, set, setContext, setExtent, setExtent, setGeometry, setPeriodic, setRandom, setSize, size, toArray, toArray, toList, 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

### CACHE_RESULTS

    public static final boolean CACHE_RESULTS

  The Constant CACHE_RESULTS.

  See Also:
    Constant Field Values

Constructor Detail

### Array

    public Array()

  Constructs an array space.

### Array

    public Array(CoordinateDiscrete extent)

  Constructs an array space of provided extent.

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

Method Detail

### findRandomMatchInRank

    public abstract 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.

  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

### findNearestMatchRank

    public abstract 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.

  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

### findNearest

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

  Finds the nearest cell that meets some condition.

  Specified by:
    `findNearest` in interface `Space`
  Overrides:
    `findNearest` 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 maximum distance to search within
  Returns:
    the location

### findWithin

    public java.util.List findWithin(Coordinate origin,
                                     Conditional condition,
                                     boolean includeOrigin,
                                     double distance)

  Returns cells that are near the provided coordinate.

  Specified by:
    `findWithin` in interface `Space`
  Overrides:
    `findWithin` in class `CollectionSpace`
  Parameters:
    `origin` - the agent to find cells near
    `distance` - the distance to form centralCells to return cells
    `includeOrigin` - should supplied agent be included in the return set
    `condition` - the condition
  Returns:
    the list

### findWithinImpl

    protected abstract java.util.List findWithinImpl(Coordinate origin,
                                                     boolean includeOrigin,
                                                     double distance)

  Returns cells that are near the provided coordinate.

  Parameters:
    `origin` - the agent to find cells near
    `distance` - the distance to form centralCells to return cells
    `includeOrigin` - should supplied agent be included in the return set
  Returns:
    the list

### replace

    public void replace(Node currentCell,
                        Node newCell)

  Changes the agent at the foirmer cells location to the supplied cell.

  Parameters:
    `currentCell` - the current cell
    `newCell` - the new cell

### swap

    public void swap(Node one,
                     Node two)

  Swaps two cells in the graph.

  Parameters:
    `one` - the one
    `two` - the two