|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public class Array2DSmallWorld
A two-dimensional space providing effecient implementations for von Neumann neighbors.
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.Array |
---|
findWithin, 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 |
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 |
---|
protected int radius
protected double randomEdgeRatio
Constructor Detail |
---|
public Array2DSmallWorld()
public Array2DSmallWorld(CoordinateDiscrete extent)
extent
- a coordinate describing the size of this spaceMethod Detail |
---|
public void initialize()
initialize
in interface Space
initialize
in class Array2D
public java.util.List calculateNeighbors(Node cell)
Discrete
calculateNeighbors
in class Discrete
cell
- the cell
public Location findNearest(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)
findNearest
in interface Space
findNearest
in class Array2D
origin
- the coordinate to find agents nearcondition
- the condition that found agent must meetincludeOrigin
- if the origin should be includeddistance
- the maximum distance around the origin to look
public int findNearestMatchRank(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance) throws java.lang.UnsupportedOperationException
Array2D
findNearestMatchRank
in class Array2D
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
java.lang.UnsupportedOperationException
public Location findRandomMatchInRank(Coordinate origin, Conditional condition, int rank) throws java.lang.UnsupportedOperationException
Array2D
findRandomMatchInRank
in class Array2D
origin
- the agent to find cells nearcondition
- the condition that found cell must meetrank
- the rank to return match in
java.lang.UnsupportedOperationException
public java.util.List findWithinImpl(Coordinate origin, boolean includeSelf, double distance)
Array
findWithinImpl
in class Array
origin
- the agent to find cells nearincludeSelf
- should supplied agent be included in the return setdistance
- the distance to form centralCells to return cells
protected java.util.Iterator bfsWithinIterator(Location origin, Conditional condition, boolean includeSelf, double distance)
Discrete
bfsWithinIterator
in class Discrete
origin
- the origincondition
- the conditionincludeSelf
- the include selfdistance
- the distance
public java.util.Iterator withinIterator(Coordinate origin, Conditional condition, boolean includeSelf, double distance)
CollectionSpace
withinIterator
in interface Space
withinIterator
in class CollectionSpace
origin
- the starting cellcondition
- the conditionincludeSelf
- should the origin be includeddistance
- the distance agents must be within to be included
public double calculateDistance(Coordinate origin, Coordinate target)
CollectionSpace
calculateDistance
in interface Space
calculateDistance
in class Discrete
origin
- one Locationtarget
- another Location
public int getRadius()
public void setRadius(int radius)
radius
- the radiuspublic double getRandomEdgeRatio()
public void setRandomEdgeRatio(double randomEdgeRatio)
randomEdgeRatio
- the random edge ratiopublic java.util.Set getSmallWorldCells()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |