org.geotools.graph
Class Node

java.lang.Object
  extended byorg.geotools.graph.GraphComponent
      extended byorg.geotools.graph.Node
All Implemented Interfaces:
org.geotools.feature.Feature
Direct Known Subclasses:
PointNode

public class Node
extends GraphComponent

A Node is a point in the graph which which is incident 0 or more edges.


Nested Class Summary
 
Nested classes inherited from class org.geotools.feature.Feature
org.geotools.feature.Feature.NULL
 
Constructor Summary
Node(org.geotools.feature.Feature feature, EdgeList edgeList)
          Creates a node.
 
Method Summary
 void addEdge(Edge edge)
          Adds an edge to the adjacency list of the node.
 com.vividsolutions.jts.geom.Geometry buildGeometry()
          Builds a Geometry object to represent the node spatially.
 java.util.Collection getAdjacentElements()
          Returns a collection of nodes adjacent to this node.
 int getDegree()
          Returns the degree of the node.
 Edge getEdge(Node other)
          Returns an edge incident with this node and another node.
 EdgeList getEdgeList()
          Returns the adjacency list of the node.
 java.util.Collection getOtherEdges(Edge edge)
          Returns a collection of edges adjacent minus a specified edge.
 void removeEdge(Edge edge)
          Removes an edge from the adjacency list of the node.
 java.lang.String toString()
          Returns a string representation of the node.
 
Methods inherited from class org.geotools.graph.GraphComponent
compareTo, getAttribute, getAttribute, getAttributes, getBounds, getCount, getDefaultGeometry, getFeature, getFeatureType, getID, getNumberOfAttributes, getParent, getSchema, isVisited, schema, setAttribute, setAttribute, setAttributes, setCount, setDefaultGeometry, setParent, setVisited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(org.geotools.feature.Feature feature,
            EdgeList edgeList)
Creates a node.

Parameters:
feature - The underlying Feature represented by the node.
edgeList - A list of edges adjacent to the node.
See Also:
GraphComponent(Feature), Feature
Method Detail

addEdge

public void addEdge(Edge edge)
Adds an edge to the adjacency list of the node.

Parameters:
edge - An edge adjacent to the node.

removeEdge

public void removeEdge(Edge edge)
Removes an edge from the adjacency list of the node.

Parameters:
edge - Edge to be removed.

getEdgeList

public EdgeList getEdgeList()
Returns the adjacency list of the node.

Returns:
A collection of edges adjacent to the node.

getEdge

public Edge getEdge(Node other)
Returns an edge incident with this node and another node.

Parameters:
other - A node at the other end of an adjacent edge.
Returns:
A single edge object adjacent to the two nodes.

getDegree

public int getDegree()
Returns the degree of the node.

Returns:
An integer representing the number of adjacent edges to the node.

getOtherEdges

public java.util.Collection getOtherEdges(Edge edge)
Returns a collection of edges adjacent minus a specified edge.

Parameters:
edge - the edge not to be returned.
Returns:
All adjacent edges - specified edge.

getAdjacentElements

public java.util.Collection getAdjacentElements()
Returns a collection of nodes adjacent to this node. More precisely, it returns a collection of nodes that are connected via an edge.

Specified by:
getAdjacentElements in class GraphComponent
Returns:
Collection
See Also:
GraphComponent.getAdjacentElements()

buildGeometry

public com.vividsolutions.jts.geom.Geometry buildGeometry()
Builds a Geometry object to represent the node spatially.

Specified by:
buildGeometry in class GraphComponent
Returns:
Geometry
See Also:
GraphComponent.buildGeometry(), Geometry

toString

public java.lang.String toString()
Returns a string representation of the node.

See Also:
Object.toString()