|
||||||||||
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.Graph
public class Graph
A space containing a simple, unweighted graph.
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 |
---|
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 | |
---|---|
Graph()
Constructs an arbitrary directed graph. |
|
Graph(CoordinateDiscrete extent)
Constructs an arbitrary directed graph. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o,
boolean isParent)
Adds the supplied object (assumed to be an agent) to this graph. |
void |
addNeighbor(Node source,
Node target)
Adds a neighbor (the target) to the source's list of neighbors. |
boolean |
addNeighbor(Node source,
Node target,
boolean directed)
Adds a neighbor (the target) to the source's list of neighbors. |
boolean |
addNeighborSafe(Node source,
Node target,
boolean directed)
Adds a neighbor (the target) to the source's list of neighbors. |
java.util.List |
calculateNeighbors(Node cell)
Calculate neighbors. |
void |
clear()
Removes all agents from the context. |
void |
clearNeighbors(Node source)
Clears the source agent's list of neighbors. |
Node |
findCellAway(Node origin,
Node target)
Returns the next cell within immediate neighborhood furthest away from the requested cell. |
Node |
findCellToward(Node origin,
Node target)
Returns the next cell within immediate neighborhood toward the requested cell. |
Location |
findNearest(Coordinate origin,
Conditional condition,
boolean includeOrigin,
double distance)
Finds the nearest agent that meets some condition. |
java.util.List |
findNeighbors(Node location)
|
java.util.HashMap |
getAdjacencyMap()
Return the adjacenty map. |
java.util.List |
getNeighborsFor(Node agent)
Gets the agent's list of neighbors. |
void |
initialize()
Initialize. |
boolean |
isNeighbor(Node source,
Node target)
Returns whether target is a neighbor of source. |
java.util.Iterator |
neighborIterator(Node source)
Return an iterator of the agent source's neighbors. |
boolean |
remove(java.lang.Object o)
Removes the supplied object (agent) from this list. |
boolean |
removeNeighbor(Node source,
Node target)
Remove agent b from a's list of neighbors. |
void |
replaceNeighbor(Node agent,
Node newNeighbor,
boolean directed)
Replaces the agent's list of neighbors with new neighbor. |
void |
setAdjacencyMap(java.util.HashMap adjacencyMap)
Sets the adjancency map. |
void |
setNeighborsFor(Node agent,
java.util.List neighbors)
Sets the agent's list of neighbors. |
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.CollectionSpace |
---|
add, addAll, calculateDistance, clone, conditionalIterator, conditionalIterator, construct, contains, containsAll, countWithin, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandom, findRandomCoordinate, findRandomWithin, findWithin, get, getContext, getExtent, getGeometry, getRandom, hasWithin, isDeleteSweepNeeded, isEmpty, isMutable, isPeriodic, iterator, iteratorCount, iteratorToList, moveAway, moveToward, newLocation, newLocation, populate, randomInRange, randomInRange, randomIs, randomizeOrder, randomToLimit, removeAll, retainAll, safeIterator, safeIterator, safeIterators, safeRandomIterator, set, setContext, setExtent, setExtent, setGeometry, setPeriodic, setRandom, setSize, size, toArray, toArray, toList |
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 |
Constructor Detail |
---|
public Graph()
public Graph(CoordinateDiscrete extent)
extent
- a coordinate describing the size of this spaceMethod Detail |
---|
public void initialize()
Space
initialize
in interface Space
initialize
in class CollectionSpace
public void clear()
CollectionSpace
clear
in interface java.util.Collection
clear
in class CollectionSpace
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 CollectionSpace
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 java.util.List findNeighbors(Node location)
findNeighbors
in class Discrete
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 Node findCellToward(Node origin, Node target)
findCellToward
in class Discrete
origin
- the current celltarget
- the cell that we are moving toward
public Node findCellAway(Node origin, Node target)
findCellAway
in class Discrete
origin
- the current celltarget
- the cell that we are moving toward
public boolean add(java.lang.Object o, boolean isParent)
add
in interface Space
add
in class CollectionSpace
o
- the agent to addisParent
- the is parent
public boolean addNeighbor(Node source, Node target, boolean directed)
source
- the agent to add a new neighbor totarget
- the neighbor to adddirected
- if the neighbor-link is one-way or two-way
public boolean addNeighborSafe(Node source, Node target, boolean directed)
source
- the agent to add a new neighbor totarget
- the neighbor to adddirected
- if the neighbor-link is one-way or two-way
public void addNeighbor(Node source, Node target)
source
- the sourcetarget
- the targetpublic boolean removeNeighbor(Node source, Node target)
source
- the sourcetarget
- the target
public java.util.Iterator neighborIterator(Node source)
source
- the agent of which neighbors are being returned
public void clearNeighbors(Node source)
source
- the agent of whose neighbors are being clearedpublic java.util.List getNeighborsFor(Node agent)
agent
- the agent whose neighbors are being returned
public void replaceNeighbor(Node agent, Node newNeighbor, boolean directed)
agent
- the agent whose neighbors are being returnednewNeighbor
- the new neighbordirected
- the directedpublic void setNeighborsFor(Node agent, java.util.List neighbors)
agent
- the agentwho neighbors are being setneighbors
- the neighborspublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in class CollectionSpace
o
- the agent to be removed
public boolean isNeighbor(Node source, Node target)
source
- the agent whose neighbor list is to be chekedtarget
- the agent who is being searched for in the neighbor list
public java.util.HashMap getAdjacencyMap()
public void setAdjacencyMap(java.util.HashMap adjacencyMap)
adjacencyMap
- the new map object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |