|
![]() |
|||||||||
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
public abstract class Discrete
A space with discrete nodes. Any space that has some kind of underyling discrete trucutre should implement this class.
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 |
performanceWarning
The performance warning. |
Fields inherited from class org.ascape.model.space.CollectionSpace |
---|
collection, ESTIMATED_MAXIMUM_SIZE, extent, geometry |
Constructor Summary | |
---|---|
Discrete()
Constructs a discrete space. |
|
Discrete(CoordinateDiscrete extent)
Constructs a discrete 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. |
static int |
calculateDistance(int o,
int t,
int bound)
Calculate distance. |
java.util.List |
calculateNeighbors(Node cell)
Calculate neighbors. |
java.util.List |
findAvailable()
Returns cells that are available, that is, uncoccupied. |
java.util.List |
findAvailable(java.util.Collection candidates)
Returns cells that are available, that is, uncoccupied. |
abstract Node |
findCellAway(Node origin,
Node target)
Returns the cell within immediate neighborhood furthest away from the requestd cell. |
protected Node |
findCellAwayBFS(Node origin,
Node target)
Find cell away BFS. |
abstract Node |
findCellToward(Node origin,
Node target)
Returns the next cell within immediate neighborhood toward the requested cell. |
protected Node |
findCellTowardBFS(Node origin,
Node target)
Find cell toward BFS. |
Location |
findNearestAvailable(Location origin,
Conditional condition,
boolean includeOrigin,
double distance)
|
Location |
findNearestBFS(Coordinate origin,
Conditional condition,
boolean includeOrigin,
double distance)
Finds the nearest agent that meets some condition. |
java.util.List |
findNeighbors(Node location)
|
java.util.List |
findOccupants()
Returns cells that are available, that is, uncoccupied. |
static java.util.List |
findOccupants(java.util.Collection candidates)
Returns all cell occupants of the provided cells. |
Node |
findRandomAvailable()
|
Node |
findRandomAvailable(Conditional condition)
|
Location |
findRandomAvailable(Node origin,
Conditional condition,
boolean includeSelf,
double distance)
|
Location |
findRandomAvailableNeighbor(Node location)
|
Location |
findRandomNeighbor(Node location)
|
Location |
findRandomNeighbor(Node location,
Conditional condition)
|
Node |
findRandomUnoccupiedCell()
Deprecated. |
Node |
findRandomUnoccupiedCell(Node excludeCell)
Returns a random unoccupied discrete location in the space. |
java.util.List |
findWithinDefault(Coordinate origin,
boolean includeSelf,
double dist)
Find within default. |
Node[] |
getCells()
Returns all agents in the space as an array of cells (use this method to avoid coercion of members to Node.) |
Node[] |
getCellsNearDefault(Node origin,
boolean includeSelf,
int distance)
Deprecated. |
int |
getDistance(Node origin,
Node target)
Deprecated. use calculateDistance instead. |
int |
getMaximumRank()
Gets the maximum rank. |
int |
getSize()
Returns the size, or number of cells, (the product of all extents) of this graph. |
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 boolean performanceWarning
Constructor Detail |
---|
public Discrete()
public Discrete(CoordinateDiscrete extent)
extent
- a coordinate describing the size of this spaceMethod Detail |
---|
public java.util.List calculateNeighbors(Node cell)
cell
- the cell
public int getSize()
getSize
in interface Space
getSize
in class CollectionSpace
public java.util.List findOccupants()
public Location findRandomNeighbor(Node location)
public Location findRandomNeighbor(Node location, Conditional condition)
public java.util.List findNeighbors(Node location)
public Location findRandomAvailableNeighbor(Node location)
public Location findRandomAvailable(Node origin, Conditional condition, boolean includeSelf, double distance)
public static java.util.List findOccupants(java.util.Collection candidates)
candidates
- the cells to return occupants of
public java.util.List findAvailable()
public java.util.List findAvailable(java.util.Collection candidates)
candidates
- the cells to return available cells from
public Node[] getCells()
public Node findRandomUnoccupiedCell()
public Node findRandomAvailable()
public Node findRandomAvailable(Conditional condition)
public Location findNearestAvailable(Location origin, Conditional condition, boolean includeOrigin, double distance)
public Node findRandomUnoccupiedCell(Node excludeCell)
excludeCell
- the exclude cell
public final Node[] getCellsNearDefault(Node origin, boolean includeSelf, int distance)
origin
- the agent to find cells nearincludeSelf
- should supplied agent be included in the return setdistance
- the distance to form centralCells to return cells
public java.util.List findWithinDefault(Coordinate origin, boolean includeSelf, double dist)
origin
- the originincludeSelf
- the include selfdist
- the dist
public abstract Node findCellToward(Node origin, Node target)
origin
- the current celltarget
- the cell that we are moving toward
public abstract Node findCellAway(Node origin, Node target)
origin
- the current celltarget
- the cell that we are moving toward
public int getMaximumRank()
public int getDistance(Node origin, Node target)
origin
- the starting celltarget
- the ending cell
public Location findNearestBFS(Coordinate origin, Conditional condition, boolean includeOrigin, double distance)
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
protected java.util.Iterator bfsWithinIterator(Location origin, Conditional condition, boolean includeSelf, double distance)
origin
- the origincondition
- the conditionincludeSelf
- the include selfdistance
- the distance
public double calculateDistance(Coordinate origin, Coordinate target)
CollectionSpace
calculateDistance
in interface Space
calculateDistance
in class CollectionSpace
origin
- one Locationtarget
- another Location
protected Node findCellTowardBFS(Node origin, Node target)
origin
- the origintarget
- the target
protected Node findCellAwayBFS(Node origin, Node target)
origin
- the origintarget
- the target
public static int calculateDistance(int o, int t, int bound)
o
- the ot
- the tbound
- the bound
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |