|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.space.CollectionSpace
org.ascape.model.space.Discrete
org.ascape.model.space.Array
org.ascape.model.space.Array2DBase
org.ascape.model.space.Array2D
public abstract class Array2D
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.
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.Array |
---|
findWithin, findWithinImpl, replace, swap |
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 |
---|
public static int MAX_RANK
Constructor Detail |
---|
public Array2D()
public Array2D(Geometry geometry, CoordinateDiscrete extent)
geometry
- geometry describing this spaceextent
- a coordinate describing the size of this spaceMethod Detail |
---|
public void initialize()
initialize
in interface Space
initialize
in class Array2DBase
protected static int getNumOfCoordinatesWithinRank(int rank)
rank
- the rank to return coordinate count for
public final double calculateDistanceMoore(Coordinate origin, Coordinate target)
origin
- the origintarget
- the target
protected final int getXSpan(Coordinate origin, Coordinate target)
origin
- the origintarget
- the target
protected final int getYSpan(Coordinate origin, Coordinate target)
origin
- the origintarget
- the target
public Location findFirstMatchInRank(Coordinate origin, Conditional condition, int rank)
origin
- the agent to find cells nearcondition
- the condition that found cell must meetrank
- the rank to return match in
public Location findNearest(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)
findNearest
in interface Space
findNearest
in class Array
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent be included in the searchdistance
- the maximum distance to search within
public int findNearestMatchRank(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)
findNearestMatchRank
in class Array
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent (rank 0) be included in the searchmaximumDistance
- the maximum distance to search within
public Location findRandomMatchInRank(Coordinate origin, Conditional condition, int rank)
findRandomMatchInRank
in class Array
origin
- the agent to find cells nearcondition
- the condition that found cell must meetrank
- the rank to return match in
public boolean hasWithin(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)
hasWithin
in interface Space
hasWithin
in class CollectionSpace
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent be included in the searchmaximumDistance
- the distance to search within
public int countWithin(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)
countWithin
in interface Space
countWithin
in class CollectionSpace
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent be included in the searchmaximumDistance
- the distance to search within
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |