Package org.locationtech.jts.planargraph
Class Subgraph
- java.lang.Object
-
- org.locationtech.jts.planargraph.Subgraph
-
public class Subgraph extends Object
A subgraph of aPlanarGraph
. A subgraph may contain any subset ofEdge
s from the parent graph. It will also automatically contain allDirectedEdge
s andNode
s 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
Fields Modifier and Type Field Description protected List
dirEdges
protected Set
edges
protected NodeMap
nodeMap
protected PlanarGraph
parentGraph
-
Constructor Summary
Constructors Constructor Description Subgraph(PlanarGraph parentGraph)
Creates a new subgraph of the givenPlanarGraph
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Edge e)
Adds anEdge
to the subgraph.boolean
contains(Edge e)
Tests whether anEdge
is contained in this subgraphIterator
dirEdgeIterator()
Returns anIterator
over theDirectedEdge
s in this graph, in the order in which they were added.Iterator
edgeIterator()
PlanarGraph
getParent()
Gets thePlanarGraph
which this subgraph is part of.Iterator
nodeIterator()
-
-
-
Field Detail
-
parentGraph
protected PlanarGraph parentGraph
-
edges
protected Set edges
-
dirEdges
protected List dirEdges
-
nodeMap
protected NodeMap nodeMap
-
-
Constructor Detail
-
Subgraph
public Subgraph(PlanarGraph parentGraph)
Creates a new subgraph of the givenPlanarGraph
- Parameters:
parentGraph
- the parent graph
-
-
Method Detail
-
getParent
public PlanarGraph getParent()
Gets thePlanarGraph
which this subgraph is part of.- Returns:
- the parent PlanarGraph
-
add
public void add(Edge e)
- Parameters:
e
- the edge to add
-
dirEdgeIterator
public Iterator dirEdgeIterator()
Returns anIterator
over theDirectedEdge
s in this graph, in the order in which they were added.- Returns:
- an iterator over the directed edges
- See Also:
add(Edge)
-
nodeIterator
public Iterator nodeIterator()
- Returns:
- an iterator over the nodes
-
-