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 Array2DSmallWorld

    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.Array2DSmallWorld

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

    public class Array2DSmallWorld

extends Array2D

A two-dimensional space providing effecient implementations for von Neumann neighbors.

Since:
  1.9.2
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
`protected int` | `radius` The radius.
`protected double` | `randomEdgeRatio` The random edge ratio.

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
`Array2DSmallWorld()` Constructs a 2-dimensional small world space.
`Array2DSmallWorld(CoordinateDiscrete extent)` Constructs a 2-dimensional small world space of provided extent.

Method Summary
`protected java.util.Iterator` | `bfsWithinIterator(Location origin, Conditional condition, boolean includeSelf, double distance)` This is the findWithin code from Graph.
`double` | `calculateDistance(Coordinate origin, Coordinate target)` Returns the shortest distance between one Location and another.
`java.util.List` | `calculateNeighbors(Node cell)` Calculate neighbors.
`Location` | `findNearest(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)` Finds the nearest agent 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.
`java.util.List` | `findWithinImpl(Coordinate origin, boolean includeSelf, double distance)` Returns cells that are near the provided coordinate.
`int` | `getRadius()` Returns the radius.
`double` | `getRandomEdgeRatio()` Returns the radius.
`java.util.Set` | `getSmallWorldCells()` Gets the small world cells.
`void` | `initialize()` Initializes the space.
`void` | `setRadius(int radius)` Set the diffusion temp value.
`void` | `setRandomEdgeRatio(double randomEdgeRatio)` Set the diffusion temp value.
`java.util.Iterator` | `withinIterator(Coordinate origin, Conditional condition, boolean includeSelf, double distance)` Returns an iteration across all agents the specified distance from the origin.

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

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, replace, swap`

Methods inherited from class org.ascape.model.space.Discrete
`calculateDistance, 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`

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

### radius

    protected int radius

  The radius.

### randomEdgeRatio

    protected double randomEdgeRatio

  The random edge ratio.

Constructor Detail

### Array2DSmallWorld

    public Array2DSmallWorld()

  Constructs a 2-dimensional small world space.

### Array2DSmallWorld

    public Array2DSmallWorld(CoordinateDiscrete extent)

  Constructs a 2-dimensional small world space of provided extent.

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

Method Detail

### initialize

    public void initialize()

  Initializes the space. For small worlds, we want to calculate the neighborhood each time.

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

### calculateNeighbors

    public java.util.List calculateNeighbors(Node cell)

  Description copied from class: `Discrete`
  Calculate neighbors.

  Overrides:
    `calculateNeighbors` in class `Discrete`
  Parameters:
    `cell` - the cell
  Returns:
    the list

### findNearest

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

  Finds the nearest agent that meets some condition. Spaces without coordinate meaning should override this method.

  Specified by:
    `findNearest` in interface `Space`
  Overrides:
    `findNearest` in class `Array2D`
  Parameters:
    `origin` - the coordinate to find agents near
    `condition` - the condition that found agent must meet
    `includeOrigin` - if the origin should be included
    `distance` - the maximum distance around the origin to look
  Returns:
    the location

### findNearestMatchRank

    public int findNearestMatchRank(Coordinate origin,
                                    Conditional condition,
                                    boolean includeOrigin,
                                    double maximumDistance)
                             throws java.lang.UnsupportedOperationException

  Description copied from class: `Array2D`
  Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches.

  Overrides:
    `findNearestMatchRank` in class `Array2D`
  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
  Throws:
    `java.lang.UnsupportedOperationException`

### findRandomMatchInRank

    public Location findRandomMatchInRank(Coordinate origin,
                                          Conditional condition,
                                          int rank)
                                   throws java.lang.UnsupportedOperationException

  Description copied from class: `Array2D`
  Returns a random element in the supplied rank that matches the supplied condition, null if no matches.

  Overrides:
    `findRandomMatchInRank` in class `Array2D`
  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
  Throws:
    `java.lang.UnsupportedOperationException`

### 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

### bfsWithinIterator

    protected java.util.Iterator bfsWithinIterator(Location origin,
                                                   Conditional condition,
                                                   boolean includeSelf,
                                                   double distance)

  Description copied from class: `Discrete`
  This is the findWithin code from Graph. This can be used by this class's findWithin, when distance is greater than 1. dist = 1 is the same as findNeighbors.

  Overrides:
    `bfsWithinIterator` in class `Discrete`
  Parameters:
    `origin` - the origin
    `condition` - the condition
    `includeSelf` - the include self
    `distance` - the distance
  Returns:
    the iterator

### withinIterator

    public java.util.Iterator withinIterator(Coordinate origin,
                                             Conditional condition,
                                             boolean includeSelf,
                                             double distance)

  Description copied from class: `CollectionSpace`
  Returns an iteration across all agents the specified distance from the origin.

  Specified by:
    `withinIterator` in interface `Space`
  Overrides:
    `withinIterator` in class `CollectionSpace`
  Parameters:
    `origin` - the starting cell
    `condition` - the condition
    `includeSelf` - should the origin be included
    `distance` - the distance agents must be within to be included
  Returns:
    the iterator

### calculateDistance

    public double calculateDistance(Coordinate origin,
                                    Coordinate target)

  Description copied from class: `CollectionSpace`
  Returns the shortest distance between one Location and another. Warning: this default method only returns a coordinate specific distance. It uses no information about the context context; for example wether it is a periodic (wrapping) space or not. Therefore, if you implement your own versions of CollectionSpace, ensure that you have properly implemented a version of this method. (All Ascape spaces properly overide this method.)

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

### getRadius

    public int getRadius()

  Returns the radius.

### setRadius

    public void setRadius(int radius)

  Set the diffusion temp value.

  Parameters:
    `radius` - the radius

### getRandomEdgeRatio

    public double getRandomEdgeRatio()

  Returns the radius.

  Returns:
    the random edge ratio

### setRandomEdgeRatio

    public void setRandomEdgeRatio(double randomEdgeRatio)

  Set the diffusion temp value.

  Parameters:
    `randomEdgeRatio` - the random edge ratio

### getSmallWorldCells

    public java.util.Set getSmallWorldCells()

  Gets the small world cells.

  Returns:
    the small world cells

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