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 Graph

    java.lang.Object
      org.ascape.model.space.CollectionSpace
          org.ascape.model.space.Discrete
              org.ascape.model.space.Graph

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

Direct Known Subclasses:
  GraphSmallWorld, SubGraph

    public class Graph

extends Discrete

A space containing a simple, unweighted graph.

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

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.Discrete
`bfsWithinIterator, calculateDistance, calculateDistance, findAvailable, findAvailable, findCellAwayBFS, findCellTowardBFS, findNearestAvailable, findNearestBFS, findOccupants, findOccupants, findRandomAvailable, findRandomAvailable, findRandomAvailable, findRandomAvailableNeighbor, findRandomNeighbor, findRandomNeighbor, findRandomUnoccupiedCell, findRandomUnoccupiedCell, findWithinDefault, getCells, getCellsNearDefault, getDistance, getMaximumRank, getSize`

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

### Graph

    public Graph()

  Constructs an arbitrary directed graph.

### Graph

    public Graph(CoordinateDiscrete extent)

  Constructs an arbitrary directed graph.

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

Method Detail

### initialize

    public void initialize()

  Description copied from interface: `Space`
  Initialize.

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

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

### calculateNeighbors

    public java.util.List calculateNeighbors(Node cell)

  Description copied from class: `Discrete`
  Calculate neighbors.

  Overrides:
    `calculateNeighbors` in class `Discrete`
  Parameters:
    `cell` - the cell
  Returns:
    the list

### findNearest

    public Location findNearest(Coordinate origin,
                                Conditional condition,
                                boolean includeOrigin,
                                double distance)

  Finds the nearest agent that meets some condition. Spaces without coordinate meaing should override this method.

  Specified by:
    `findNearest` in interface `Space`
  Overrides:
    `findNearest` in class `CollectionSpace`
  Parameters:
    `origin` - the coordinate to find agents near
    `condition` - the condition that found agent must meet
    `includeOrigin` - if the origin should be included
    `distance` - the maximum distance around the origin to look
  Returns:
    the location

### findNeighbors

    public java.util.List findNeighbors(Node location)

  Overrides:
    `findNeighbors` in class `Discrete`

### withinIterator

    public java.util.Iterator withinIterator(Coordinate origin,
                                             Conditional condition,
                                             boolean includeSelf,
                                             double distance)

  Description copied from class: `CollectionSpace`
  Returns an iteration across all agents the specified distance from the origin.

  Specified by:
    `withinIterator` in interface `Space`
  Overrides:
    `withinIterator` in class `CollectionSpace`
  Parameters:
    `origin` - the starting cell
    `condition` - the condition
    `includeSelf` - should the origin be included
    `distance` - the distance agents must be within to be included
  Returns:
    the iterator

### findCellToward

    public Node findCellToward(Node origin,
                               Node target)

  Returns the next cell within immediate neighborhood toward the requested cell. If no path exists between the origin andthe target, returns the origin. If more than one are same distance, properly randomizes results.

  Specified by:
    `findCellToward` in class `Discrete`
  Parameters:
    `origin` - the current cell
    `target` - the cell that we are moving toward
  Returns:
    the node

### findCellAway

    public Node findCellAway(Node origin,
                             Node target)

  Returns the next cell within immediate neighborhood furthest away from the requested cell. If more than one are same distance, properly randomizes results.

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

### add

    public boolean add(java.lang.Object o,
                       boolean isParent)

  Adds the supplied object (assumed to be an agent) to this graph.

  Specified by:
    `add` in interface `Space`
  Overrides:
    `add` in class `CollectionSpace`
  Parameters:
    `o` - the agent to add
    `isParent` - the is parent
  Returns:
    true, if add

### addNeighbor

    public boolean addNeighbor(Node source,
                               Node target,
                               boolean directed)

  Adds a neighbor (the target) to the source's list of neighbors. The directed flag determines if the link is one-way.

  Parameters:
    `source` - the agent to add a new neighbor to
    `target` - the neighbor to add
    `directed` - if the neighbor-link is one-way or two-way
  Returns:
    true, if add neighbor

### addNeighborSafe

    public boolean addNeighborSafe(Node source,
                                   Node target,
                                   boolean directed)

  Adds a neighbor (the target) to the source's list of neighbors. The directed flag determines if the link is one-way.

  Parameters:
    `source` - the agent to add a new neighbor to
    `target` - the neighbor to add
    `directed` - if the neighbor-link is one-way or two-way
  Returns:
    true, if add neighbor safe

### addNeighbor

    public void addNeighbor(Node source,
                            Node target)

  Adds a neighbor (the target) to the source's list of neighbors. By default, the connection is one-way.

  Parameters:
    `source` - the source
    `target` - the target

### removeNeighbor

    public boolean removeNeighbor(Node source,
                                  Node target)

  Remove agent b from a's list of neighbors. If b is found in the list, return true. Else, return false.

  Parameters:
    `source` - the source
    `target` - the target
  Returns:
    true, if remove neighbor

### neighborIterator

    public java.util.Iterator neighborIterator(Node source)

  Return an iterator of the agent source's neighbors.

  Parameters:
    `source` - the agent of which neighbors are being returned
  Returns:
    an iterator of agents

### clearNeighbors

    public void clearNeighbors(Node source)

  Clears the source agent's list of neighbors.

  Parameters:
    `source` - the agent of whose neighbors are being cleared

### getNeighborsFor

    public java.util.List getNeighborsFor(Node agent)

  Gets the agent's list of neighbors.

  Parameters:
    `agent` - the agent whose neighbors are being returned
  Returns:
    list the neighbors

### replaceNeighbor

    public void replaceNeighbor(Node agent,
                                Node newNeighbor,
                                boolean directed)

  Replaces the agent's list of neighbors with new neighbor.

  Parameters:
    `agent` - the agent whose neighbors are being returned
    `newNeighbor` - the new neighbor
    `directed` - the directed

### setNeighborsFor

    public void setNeighborsFor(Node agent,
                                java.util.List neighbors)

  Sets the agent's list of neighbors.

  Parameters:
    `agent` - the agentwho neighbors are being set
    `neighbors` - the neighbors

### remove

    public boolean remove(java.lang.Object o)

  Removes the supplied object (agent) from this list.

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

### isNeighbor

    public boolean isNeighbor(Node source,
                              Node target)

  Returns whether target is a neighbor of source.

  Parameters:
    `source` - the agent whose neighbor list is to be cheked
    `target` - the agent who is being searched for in the neighbor list
  Returns:
    true if they're neighbors, else false

### getAdjacencyMap

    public java.util.HashMap getAdjacencyMap()

  Return the adjacenty map.

  Returns:
    the map

### setAdjacencyMap

    public void setAdjacencyMap(java.util.HashMap adjacencyMap)

  Sets the adjancency map.

  Parameters:
    `adjacencyMap` - the new map object

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