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 Array2DBase

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

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

Direct Known Subclasses:
  Array2D

    public abstract class Array2DBase

extends Array
implements Relative

The Class Array2DBase.

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 Node[][]` | `cells` The actual 2D array of agents.
`protected int` | `currentPositionInRank` The current position within the current rank for this enumeration.
`protected int` | `currentRank` The current distance from the origin for this enumeration.
`protected boolean` | `nearnessLineOfSight` Should movement or line of sight be used for interpreting 'nearness'? Default is line of sight for the moment, but will change as soon as code is completed.
`protected int[]` | `order` The order.
`static int` | `rankLimit` The rank limit.
`protected int[][][]` | `relativeCoordinates` The relative coordinates.
`protected static double[]` | `relativeCoordinatesRankDistance` The relative coordinates rank distance.
`protected static int[]` | `relativeCoordinatesRankLengths` The relative coordinates rank lengths.
`protected static int[][][]` | `relativeCoordinatesTemplate` The Constant relativeCoordinatesTemplate.
`protected static int[]` | `sumOfCoordinatesWithinRank` The sum of coordinates within rank.

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
`Array2DBase()` Constructs a base 2-dimensional array space of provided extent.
`Array2DBase(CoordinateDiscrete extent)` Constructs a base 2-dimensional array space of provided extent.

Method Summary
`boolean` | `add(java.lang.Object o)` Adds the supplied object (agent) to this collection.
`boolean` | `addAll(java.util.Collection c)` Adds all of the agent in the specified collection to the end of the context.
`void` | `clear()` Removes all agents from the context.
`java.lang.Object` | `clone()` Overides the clone method to do a deep clone of member state so that such state will not be shared between scapes.
`void` | `construct()` Contructs the basic space structure.
`boolean` | `contains(java.lang.Object o)` Returns true if the context collection contains the object (agent.)
`boolean` | `containsAll(java.util.Collection c)` Returns true if this collection contains all of agents in the specified collection.
`Node` | `findCellAway(Node originCell, Node targetCell)` Returns the cell within immediate neighborhood furthest away from the requestd cell.
`Node[]` | `findCells(Conditional condition)` Finds cells within the space that meet some condition.
`Node[]` | `findCells(Conditional condition, int _x, int _y, int width, int height)` Finds cells within the specified space that meet some condition.
`Node` | `findCellToward(Node originCell, Node targetCell)` Returns the next cell within immediate neighborhood toward the requested cell.
`Location` | `findRandom()` Returns a cell randomly selected from the lattice.
`Location` | `findRandom(int x, int y, int width, int height)` Returns a random unoccupied discrete location in the space given with the lattice.
`Location` | `findRandom(Node cell, int x, int y, int width, int height)` Returns a random unoccupied discrete location in the space given with the lattice.
`Coordinate` | `findRandomCoordinate()` Returns a coordinate randomly selected from the lattice's space.
`Location` | `findRandomRelative(Node cell, int x, int y, int width, int height)` Returns a random unoccupied discrete location in the space given with the lattice.
`Node` | `findRandomUnoccupied(int x, int y, int width, int height)` Returns a random unoccupied discrete location in the space given with the lattice.
`Location` | `findRelative(Location location, Coordinate coordinate)` Locates a cell based on a relative reference.
`java.util.List` | `findWithinEuclidian(Coordinate origin, boolean includeSelf, double dist)` Find within euclidian.
`java.util.List` | `findWithinMoore(Coordinate origin, boolean includeSelf, double distanceDouble)` Find within moore.
`java.util.List` | `findWithinVonNeumann(Coordinate origin, boolean includeSelf, double dist)` Find within von neumann.
`java.util.List` | `findWithinVonNeumannLineOfSight(Coordinate origin, boolean includeSelf, double dist)` Find within von neumann line of sight.
`java.util.List` | `findWithinVonNeumannMovement(Coordinate origin, boolean includeSelf, double distance)` Find within von neumann movement.
`Location` | `get(Coordinate coordinate)` Returns the cell existing at the specified coordinate.
`Node` | `get(int xPosition, int yPosition)` Returns the cell existing at the specified integer coordinates.
`Node[]` | `getCellsNearVonNeumannLineOfSight(Node origin, boolean includeSelf, int distance)` Deprecated.
`Node[]` | `getCellsNearVonNeumannMovement(Node origin, boolean includeSelf, int distance)` Deprecated.
`int` | `getSize()` Returns the size, or number of cells, (the product of all extents) of this two-dimensional array.
`int` | `getXSize()` Returns the horizontal span of the array.
`int` | `getYSize()` Returns the vertical span of the array.
`void` | `initialize()` Initializes the space, copying a set of relative coordinates for use, and ensuring that the ordering used for random draws starts consistently.
`boolean` | `isEmpty()` Are there no agents in this context?.
`boolean` | `isMutable()` Is the context mutable, that is, can it change its structure at runtime? Returns true for this collection.
`boolean` | `isNearnessLineOfSight()` Should 'nearness' be interpreted as where an agent can move, or where the agent has line of sight? This is important for von Neumann geometry, but irrelevant otherwise.
`boolean` | `isValid(CoordinateDiscrete coordinate)` Determines whether the supplied coordinate is valid in the space.
`boolean` | `isValid(int xPosition, int yPosition)` Determines whether the supplied position is valid in the space.
`java.util.Iterator` | `iterator()` Returns an iterator across all agents in this context.
`void` | `populate()` Populates the space with clones of the prototype agent.
`void` | `randomizeCallingOrder()` Randomizes the lookup used to determine calling order for random order execution of rules.
`protected void` | `randomizeRank(int rank)` Randomizes the coordinates within the specified rank.
`boolean` | `remove(java.lang.Object o)` Removes the supplied object (agent) from this collection.
`boolean` | `removeAll(java.util.Collection c)` Removes all of the agents contained in the collection.
`boolean` | `retainAll(java.util.Collection c)` Retains only the elements in the context that are in the specified collection.
`ResetableIterator` | `safeIterator()` Returns a context iterator across all objects in this context.
`ResetableIterator` | `safeIterator(int start, int limit)` Safe iterator.
`RandomIterator` | `safeRandomIterator()` Returns a context iterator across all agents in random order.
`void` | `set(Coordinate coordinate, Location cell)` Sets the cell existing at the specified coordinate.
`void` | `set(int xPosition, int yPosition, Location cell)` Sets the cell existing at the specified coordinate.
`void` | `setExtent(Coordinate extent)` Sets the size of the space.
`void` | `setExtent(int xSize, int ySize)` Sets the size of the space.
`void` | `setGeometry(Geometry geometry)` Sets the geometry of this space.
`void` | `setNearnessLineOfSight(boolean nearnessLineOfSight)` Returns wether line of sight is being used as the interpretation for von Neumann geometry nearness.
`int` | `size()` Returns the number of agents in the context.
`java.lang.Object[]` | `toArray()` Returns an array containing all of the elements in this collection in proper sequence.
`java.lang.Object[]` | `toArray(java.lang.Object[] a)` Returns an array containing the current agents in this context; the runtime type is specified by the passed array.
`java.util.List` | `toList()`

Methods inherited from class org.ascape.model.space.Array
`findNearest, findNearestMatchRank, findRandomMatchInRank, 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, countWithin, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandomWithin, getContext, getExtent, getGeometry, getRandom, hasWithin, 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

### cells

    protected Node[][] cells

  The actual 2D array of agents.

### order

    protected int[] order

  The order.

### nearnessLineOfSight

    protected boolean nearnessLineOfSight

  Should movement or line of sight be used for interpreting 'nearness'? Default is line of sight for the moment, but will change as soon as code is completed.

### relativeCoordinatesTemplate

    protected static final int[][][] relativeCoordinatesTemplate

  The Constant relativeCoordinatesTemplate.

### relativeCoordinates

    protected int[][][] relativeCoordinates

  The relative coordinates.

### relativeCoordinatesRankLengths

    protected static int[] relativeCoordinatesRankLengths

  The relative coordinates rank lengths.

### relativeCoordinatesRankDistance

    protected static double[] relativeCoordinatesRankDistance

  The relative coordinates rank distance.

### sumOfCoordinatesWithinRank

    protected static int[] sumOfCoordinatesWithinRank

  The sum of coordinates within rank.

### rankLimit

    public static int rankLimit

  The rank limit.

### currentRank

    protected int currentRank

  The current distance from the origin for this enumeration.

### currentPositionInRank

    protected int currentPositionInRank

  The current position within the current rank for this enumeration.

Constructor Detail

### Array2DBase

    public Array2DBase()

  Constructs a base 2-dimensional array space of provided extent.

### Array2DBase

    public Array2DBase(CoordinateDiscrete extent)

  Constructs a base 2-dimensional array space of provided extent.

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

Method Detail

### clone

    public java.lang.Object clone()

  Overides the clone method to do a deep clone of member state so that such state will not be shared between scapes. The key here is that CollectionSpace ignores the prototype agent's extent, and since CollectionSpace is by default a 1D space, we need to be sure the 2D characteristic of the prototype agent isn't lost.

  Specified by:
    `clone` in interface `Space`
  Overrides:
    `clone` in class `CollectionSpace`
  Returns:
    the object

### construct

    public void construct()

  Contructs the basic space structure. Instantiates the cells, but does not populate them. Geometry and extent should be set before calling this method.

  Specified by:
    `construct` in interface `Space`
  Overrides:
    `construct` in class `CollectionSpace`

### populate

    public void populate()

  Populates the space with clones of the prototype agent. Prototype agent should be set before calling this method. (By default, the prototpye agent is a Node.)

  Specified by:
    `populate` in interface `Space`
  Overrides:
    `populate` in class `CollectionSpace`

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

### setGeometry

    public void setGeometry(Geometry geometry)

  Sets the geometry of this space. Must of course be a one-dimensional geometry.

  Overrides:
    `setGeometry` in class `CollectionSpace`
  Parameters:
    `geometry` - the basic geometry of this space

### setExtent

    public void setExtent(Coordinate extent)

  Sets the size of the space. The extent defines the limit of the lattice (exclusive) from the origin (inclusive), so that the extent also represents the size of the lattice. It is an error to set extent while a space is running.

  Specified by:
    `setExtent` in interface `Space`
  Overrides:
    `setExtent` in class `CollectionSpace`
  Parameters:
    `extent` - a coordinate at the maximum extent

### setExtent

    public void setExtent(int xSize,
                          int ySize)

  Sets the size of the space. The extent defines the limit of the lattice (exclusive) from the origin (inclusive), so that the extent also represents the size of the lattice. It is an error to set extent while a space is running.

  Parameters:
    `xSize` - the horizontal size (width) of the space
    `ySize` - the vertical size (height) of the space

### randomizeCallingOrder

    public void randomizeCallingOrder()

  Randomizes the lookup used to determine calling order for random order execution of rules.

### iterator

    public java.util.Iterator iterator()

  Description copied from class: `CollectionSpace`
  Returns an iterator across all agents in this context. Note that this is simply an iterator of the backing collections members. It will have different behavior than is typically desried when iterating behavior across a context*; so for instance, this method is not used by the internal rule mechanism. It should be perfectly adequete for tight iterations across agents when there are no additions or deletions during the iteration; for instance, when calcualting some value across a number of agents. *The iterator will not be aware of an agents deletion from the context after its creation; this is because the context caches these removals to improve performance. It may include agents that are added to the context after its creation, and this is typically not desirable behavior when touring a collection of current agents.

  Specified by:
    `iterator` in interface `java.lang.Iterable`
  Specified by:
    `iterator` in interface `java.util.Collection`
  Overrides:
    `iterator` in class `CollectionSpace`
  Returns:
    an iterator over the agents in context order

### safeIterator

    public ResetableIterator safeIterator()

  Description copied from class: `CollectionSpace`
  Returns a context iterator across all objects in this context. This iterator differs from a collection iterator in two fundamental ways. First, it handles deletions and adds differently. It does not include any objects that are added after the iterator has been created, and it correctly deals with the case where agents are removed from the context after the creation of the iterator. (As such deletions are marked for a later delete sweep, but not actually removed the iterator has to be aware of them.) Second, it allows these deletions to occur after an iteration has been created, without throwing a ConcurrentModificationExcpetion on a `next` (or similar) call. Such modifications (say during the execution of fission or death behaviors) during a particular behavior are expected. The important thing is that objects that have been removed from a context do not have rules executed upon them, and that new agents added to a context do not have behavior executed on them in the current iteration. This iterator ensures that.

  Specified by:
    `safeIterator` in interface `Space`
  Overrides:
    `safeIterator` in class `CollectionSpace`
  Returns:
    an iterator over the agents in context order

### safeIterator

    public ResetableIterator safeIterator(int start,
                                          int limit)

  Description copied from interface: `Space`
  Safe iterator.

  Specified by:
    `safeIterator` in interface `Space`
  Overrides:
    `safeIterator` in class `CollectionSpace`
  Parameters:
    `start` - the start
    `limit` - the limit
  Returns:
    the resetable iterator

### safeRandomIterator

    public RandomIterator safeRandomIterator()

  Description copied from class: `CollectionSpace`
  Returns a context iterator across all agents in random order. Other than its random order, it has identical behavior to context iterator; see the important notes for that method.

  Specified by:
    `safeRandomIterator` in interface `Space`
  Overrides:
    `safeRandomIterator` in class `CollectionSpace`
  Returns:
    an iterator over the agents in context order

### isMutable

    public boolean isMutable()

  Description copied from class: `CollectionSpace`
  Is the context mutable, that is, can it change its structure at runtime? Returns true for this collection.

  Specified by:
    `isMutable` in interface `Space`
  Overrides:
    `isMutable` in class `CollectionSpace`
  Returns:
    true, if is mutable

### getSize

    public int getSize()

  Returns the size, or number of cells, (the product of all extents) of this two-dimensional array.

  Specified by:
    `getSize` in interface `Space`
  Overrides:
    `getSize` in class `Discrete`
  Returns:
    the size

### getXSize

    public int getXSize()

  Returns the horizontal span of the array.

  Returns:
    the x size

### getYSize

    public int getYSize()

  Returns the vertical span of the array.

  Returns:
    the y size

### findCells

    public Node[] findCells(Conditional condition)

  Finds cells within the space that meet some condition.

  Parameters:
    `condition` - the condition that found cell must meet
  Returns:
    the node[]

### findCells

    public Node[] findCells(Conditional condition,
                            int _x,
                            int _y,
                            int width,
                            int height)

  Finds cells within the specified space that meet some condition.

  Parameters:
    `condition` - the condition that found cell must meet
    `_x` - the leftmost cell location
    `_y` - the topmost cell location
    `width` - the number of vertical cells
    `height` - the number of horizontal cells
  Returns:
    the node[]

### findRandom

    public Location findRandom()

  Returns a cell randomly selected from the lattice.

  Specified by:
    `findRandom` in interface `Space`
  Overrides:
    `findRandom` in class `CollectionSpace`
  Returns:
    the location

### findRandom

    public Location findRandom(int x,
                               int y,
                               int width,
                               int height)

  Returns a random unoccupied discrete location in the space given with the lattice.

  Parameters:
    `x` - the leftmost cell location
    `y` - the top cell location
    `width` - the number of vertical cells
    `height` - the number of horizontal cells
  Returns:
    the location

### findRandomRelative

    public final Location findRandomRelative(Node cell,
                                             int x,
                                             int y,
                                             int width,
                                             int height)

  Returns a random unoccupied discrete location in the space given with the lattice.

  Parameters:
    `cell` - a cell to exclude from search (typically origin)
    `x` - the leftmost cell location
    `y` - the top cell location
    `width` - the number of vertical cells
    `height` - the number of horizontal cells
  Returns:
    the location

### findRandom

    public final Location findRandom(Node cell,
                                     int x,
                                     int y,
                                     int width,
                                     int height)

  Returns a random unoccupied discrete location in the space given with the lattice.

  Parameters:
    `cell` - a cell to exclude from search (typically origin)
    `x` - the leftmost cell location
    `y` - the top cell location
    `width` - the number of vertical cells
    `height` - the number of horizontal cells
  Returns:
    the location

### findRandomUnoccupied

    public Node findRandomUnoccupied(int x,
                                     int y,
                                     int width,
                                     int height)

  Returns a random unoccupied discrete location in the space given with the lattice. Returns null if no random locations are available, but an unoccupied location, even if only one exists. This method first tries testing random locations within the grid, and the first n (10) are found to be unnoccupied, the number of random locations is assumed to be sparse, and a search of all random locations is done.

  Parameters:
    `x` - the leftmost cell location
    `y` - the top cell location
    `width` - the number of vertical cells
    `height` - the number of horizontal cells
  Returns:
    the node

### findRandomCoordinate

    public Coordinate findRandomCoordinate()

  Returns a coordinate randomly selected from the lattice's space.

  Specified by:
    `findRandomCoordinate` in interface `Space`
  Overrides:
    `findRandomCoordinate` in class `CollectionSpace`
  Returns:
    the coordinate

### isValid

    public boolean isValid(CoordinateDiscrete coordinate)

  Determines whether the supplied coordinate is valid in the space.

  Parameters:
    `coordinate` - the position to check
  Returns:
    true, if is valid

### findRelative

    public Location findRelative(Location location,
                                 Coordinate coordinate)

  Locates a cell based on a relative reference. e.g. given a Location with coordiante [10,10] and a relative coordinate [-1, 1], method will return location at [9, 11]. Does not fail if relative coordinate not in space, instead returns null.

  Specified by:
    `findRelative` in interface `Relative`
  Parameters:
    `location` - the origin location
    `coordinate` - the delta from location
  Returns:
    relative location if in bounds, otherwise null

### get

    public Location get(Coordinate coordinate)

  Returns the cell existing at the specified coordinate. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first, otherwise a RuntimeException wil result.

  Specified by:
    `get` in interface `Space`
  Overrides:
    `get` in class `CollectionSpace`
  Parameters:
    `coordinate` - a coordinate asserted to be within the space
  Returns:
    the location
  See Also:
    `isValid(org.ascape.model.space.CoordinateDiscrete)`

### set

    public void set(Coordinate coordinate,
                    Location cell)

  Sets the cell existing at the specified coordinate. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.

  Specified by:
    `set` in interface `Space`
  Overrides:
    `set` in class `CollectionSpace`
  Parameters:
    `coordinate` - the coordinate
    `cell` - the cell

### set

    public void set(int xPosition,
                    int yPosition,
                    Location cell)

  Sets the cell existing at the specified coordinate. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.

  Parameters:
    `xPosition` - the x position
    `yPosition` - the y position
    `cell` - the cell

### isValid

    public boolean isValid(int xPosition,
                           int yPosition)

  Determines whether the supplied position is valid in the space. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.

  Parameters:
    `xPosition` - the x position to check
    `yPosition` - the y position to check
  Returns:
    true, if is valid

### get

    public Node get(int xPosition,
                    int yPosition)

  Returns the cell existing at the specified integer coordinates.

  Parameters:
    `xPosition` - the x position
    `yPosition` - the y position
  Returns:
    the node

### add

    public boolean add(java.lang.Object o)

  Description copied from class: `CollectionSpace`
  Adds the supplied object (agent) to this collection.

  Specified by:
    `add` in interface `java.util.Collection`
  Overrides:
    `add` in class `CollectionSpace`
  Parameters:
    `o` - the a
  Returns:
    true, if add

### addAll

    public boolean addAll(java.util.Collection c)

  Description copied from class: `CollectionSpace`
  Adds all of the agent in the specified collection to the end of the context. Assumes (but does not check) that all of the elements are instances of agent.

  Specified by:
    `addAll` in interface `java.util.Collection`
  Overrides:
    `addAll` in class `CollectionSpace`
  Parameters:
    `c` - collection whose agents are to be added to the context
  Returns:
    true if the context had new agents added

### clear

    public void clear()

  Description copied from class: `CollectionSpace`
  Removes all agents from the context.

  Specified by:
    `clear` in interface `java.util.Collection`
  Overrides:
    `clear` in class `CollectionSpace`

### contains

    public boolean contains(java.lang.Object o)

  Description copied from class: `CollectionSpace`
  Returns true if the context collection contains the object (agent.)

  Specified by:
    `contains` in interface `java.util.Collection`
  Overrides:
    `contains` in class `CollectionSpace`
  Parameters:
    `o` - the agent to search for
  Returns:
    true if the context contains the agent

### containsAll

    public boolean containsAll(java.util.Collection c)

  Description copied from class: `CollectionSpace`
  Returns true if this collection contains all of agents in the specified collection.

  Specified by:
    `containsAll` in interface `java.util.Collection`
  Overrides:
    `containsAll` in class `CollectionSpace`
  Parameters:
    `c` - collection of agents to be found in the context
  Returns:
    true if this context contains all of the agents in the collection

### isEmpty

    public boolean isEmpty()

  Description copied from class: `CollectionSpace`
  Are there no agents in this context?.

  Specified by:
    `isEmpty` in interface `java.util.Collection`
  Overrides:
    `isEmpty` in class `CollectionSpace`
  Returns:
    true if the context is empty

### remove

    public boolean remove(java.lang.Object o)

  Description copied from class: `CollectionSpace`
  Removes the supplied object (agent) from this collection.

  Specified by:
    `remove` in interface `java.util.Collection`
  Overrides:
    `remove` in class `CollectionSpace`
  Parameters:
    `o` - the agent to be removed
  Returns:
    true if the agent was deleted, false otherwise

### removeAll

    public boolean removeAll(java.util.Collection c)

  Description copied from class: `CollectionSpace`
  Removes all of the agents contained in the collection. No attempt is made to cache the removal; the agents are all removed at once.

  Specified by:
    `removeAll` in interface `java.util.Collection`
  Overrides:
    `removeAll` in class `CollectionSpace`
  Parameters:
    `c` - collection whose agents are to be added to the context
  Returns:
    true if the context had agents (but not neccessarily all?) removed

### retainAll

    public boolean retainAll(java.util.Collection c)

  Description copied from class: `CollectionSpace`
  Retains only the elements in the context that are in the specified collection.

  Specified by:
    `retainAll` in interface `java.util.Collection`
  Overrides:
    `retainAll` in class `CollectionSpace`
  Parameters:
    `c` - collection whose agents are to be retained in the context
  Returns:
    true if this context had agents removed

### size

    public int size()

  Description copied from class: `CollectionSpace`
  Returns the number of agents in the context.

  Specified by:
    `size` in interface `java.util.Collection`
  Overrides:
    `size` in class `CollectionSpace`
  Returns:
    the number of agents in the context

### toArray

    public java.lang.Object[] toArray()

  Description copied from class: `CollectionSpace`
  Returns an array containing all of the elements in this collection in proper sequence. Obeys the general contract of the `Collection.toArray` method.

  Specified by:
    `toArray` in interface `java.util.Collection`
  Overrides:
    `toArray` in class `CollectionSpace`
  Returns:
    an array containing all of the elements in this collection in proper sequence.
  See Also:
    `Arrays.asList(java.lang.Object[])`

### toList

    public java.util.List toList()

  Overrides:
    `toList` in class `CollectionSpace`

### toArray

    public java.lang.Object[] toArray(java.lang.Object[] a)

  Description copied from class: `CollectionSpace`
  Returns an array containing the current agents in this context; the runtime type is specified by the passed array.

  Specified by:
    `toArray` in interface `java.util.Collection`
  Overrides:
    `toArray` in class `CollectionSpace`
  Parameters:
    `a` - the array to copy the agents to
  Returns:
    an array containing the agents

### isNearnessLineOfSight

    public boolean isNearnessLineOfSight()

  Should 'nearness' be interpreted as where an agent can move, or where the agent has line of sight? This is important for von Neumann geometry, but irrelevant otherwise. If we are using von Neuman geometry, we can intrpret getDistance, getCellsNear, findMaximum, etc., as searching within 'n' cells, where n is the distance to search. The question is wether this search only looks within the presumed 'line of sight' of the agent, or where the agent can move one cell at a time. That is, when use line of sight interpretation is false (default), we use: N NNN NNTNN NNN N Whereas is use line of sight intrpretation is true, we would use: N N NNTNN N N Note that this menas that if this interpreation is used for von Neumann distance, many cells will have infinite distance from the source, since there is no line of site way to reach them! This interpretation is neccessary to support the Sugarscae models.

  Returns:
    true, if is nearness line of sight

### setNearnessLineOfSight

    public void setNearnessLineOfSight(boolean nearnessLineOfSight)

  Returns wether line of sight is being used as the interpretation for von Neumann geometry nearness. Default is true for the moment, but will change as soon as code is completed.

  Parameters:
    `nearnessLineOfSight` - should line of sight be used as the interpreation for 'nearness'
  See Also:
    `isNearnessLineOfSight()`

### randomizeRank

    protected void randomizeRank(int rank)

  Randomizes the coordinates within the specified rank.

  Parameters:
    `rank` - the rank to shuffle

### findWithinMoore

    public java.util.List findWithinMoore(Coordinate origin,
                                          boolean includeSelf,
                                          double distanceDouble)

  Find within moore.

  Parameters:
    `origin` - the origin
    `includeSelf` - the include self
    `distanceDouble` - the distance double
  Returns:
    the list

### findWithinVonNeumann

    public java.util.List findWithinVonNeumann(Coordinate origin,
                                               boolean includeSelf,
                                               double dist)

  Find within von neumann.

  Parameters:
    `origin` - the origin
    `includeSelf` - the include self
    `dist` - the dist
  Returns:
    the list

### getCellsNearVonNeumannMovement

    public final Node[] getCellsNearVonNeumannMovement(Node origin,
                                                       boolean includeSelf,
                                                       int distance)

  Deprecated.

  This method returns cells that are near the provided cell in von Neumann space using the movement interpretation. Typically called from getCellsNearVonNeumann based on value of nearnessLineOfSight. Ex: for distance = 2, the neighhborhood would look like: N NNN NNTNN NNN N Not: N N NNTNN N N

  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 cells near von neumann movement

### findWithinVonNeumannMovement

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

  Find within von neumann movement.

  Parameters:
    `origin` - the origin
    `includeSelf` - the include self
    `distance` - the distance
  Returns:
    the list

### getCellsNearVonNeumannLineOfSight

    public final Node[] getCellsNearVonNeumannLineOfSight(Node origin,
                                                          boolean includeSelf,
                                                          int distance)

  Deprecated.

  This method returns cells that are near the provided cell in von Neumann space using the Line of Sight Interpretation. Typically called from getCellsNearVonNeumann based on value of nearnessLineOfSight. Ex: for distance = 2, the neighhborhood would look like: N N NNTNN N N Not: N NNN NNTNN NNN N

  Parameters:
    `origin` - the agent to find cells near
    `distance` - the distance to form centralCells to return cells
    `includeSelf` - should supplied agent be included in the return set
  Returns:
    the cells near von neumann line of sight

### findWithinVonNeumannLineOfSight

    public java.util.List findWithinVonNeumannLineOfSight(Coordinate origin,
                                                          boolean includeSelf,
                                                          double dist)

  Find within von neumann line of sight.

  Parameters:
    `origin` - the origin
    `includeSelf` - the include self
    `dist` - the dist
  Returns:
    the list

### findWithinEuclidian

    public java.util.List findWithinEuclidian(Coordinate origin,
                                              boolean includeSelf,
                                              double dist)

  Find within euclidian.

  Parameters:
    `origin` - the origin
    `includeSelf` - the include self
    `dist` - the dist
  Returns:
    the list

### findCellToward

    public Node findCellToward(Node originCell,
                               Node targetCell)

  Returns the next cell within immediate neighborhood toward the requested cell. This method is used for both the Moore and Euclidian case, and overridden for the von Neumann and smallworld cases.

  Specified by:
    `findCellToward` in class `Discrete`
  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. This method is used for both the Moore and Euclidian case, and overridden for the von Neumann and smallworld cases.

  Specified by:
    `findCellAway` in class `Discrete`
  Parameters:
    `originCell` - the current cell
    `targetCell` - the cell that we are moving toward
  Returns:
    the node

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