JTS Topology Suite version 1.13

com.vividsolutions.jts.planargraph
Class Subgraph

java.lang.Object
  extended by com.vividsolutions.jts.planargraph.Subgraph

public class Subgraph
extends java.lang.Object

A subgraph of a PlanarGraph. A subgraph may contain any subset of Edges from the parent graph. It will also automatically contain all DirectedEdges and Nodes associated with those edges. No new objects are created when edges are added - all associated components must already exist in the parent graph.


Field Summary
protected  java.util.List dirEdges
           
protected  java.util.Set edges
           
protected  NodeMap nodeMap
           
protected  PlanarGraph parentGraph
           
 
Constructor Summary
Subgraph(PlanarGraph parentGraph)
          Creates a new subgraph of the given PlanarGraph
 
Method Summary
 void add(Edge e)
          Adds an Edge to the subgraph.
 boolean contains(Edge e)
          Tests whether an Edge is contained in this subgraph
 java.util.Iterator dirEdgeIterator()
          Returns an Iterator over the DirectedEdges in this graph, in the order in which they were added.
 java.util.Iterator edgeIterator()
          Returns an Iterator over the Edges in this graph, in the order in which they were added.
 PlanarGraph getParent()
          Gets the PlanarGraph which this subgraph is part of.
 java.util.Iterator nodeIterator()
          Returns an Iterator over the Nodes in this graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentGraph

protected PlanarGraph parentGraph

edges

protected java.util.Set edges

dirEdges

protected java.util.List dirEdges

nodeMap

protected NodeMap nodeMap
Constructor Detail

Subgraph

public Subgraph(PlanarGraph parentGraph)
Creates a new subgraph of the given PlanarGraph

Parameters:
parentGraph - the parent graph
Method Detail

getParent

public PlanarGraph getParent()
Gets the PlanarGraph which this subgraph is part of.

Returns:
the parent PlanarGraph

add

public void add(Edge e)
Adds an Edge to the subgraph. The associated DirectedEdges and Nodes are also added.

Parameters:
e - the edge to add

dirEdgeIterator

public java.util.Iterator dirEdgeIterator()
Returns an Iterator over the DirectedEdges in this graph, in the order in which they were added.

Returns:
an iterator over the directed edges
See Also:
add(Edge)

edgeIterator

public java.util.Iterator edgeIterator()
Returns an Iterator over the Edges in this graph, in the order in which they were added.

Returns:
an iterator over the edges
See Also:
add(Edge)

nodeIterator

public java.util.Iterator nodeIterator()
Returns an Iterator over the Nodes in this graph.

Returns:
an iterator over the nodes

contains

public boolean contains(Edge e)
Tests whether an Edge is contained in this subgraph

Parameters:
e - the edge to test
Returns:
true if the edge is contained in this subgraph

JTS Topology Suite version 1.13