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 ofEdges from the parent graph. It will also automatically contain allDirectedEdges andNodes 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 ListdirEdgesprotected Setedgesprotected NodeMapnodeMapprotected PlanarGraphparentGraph
-
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 voidadd(Edge e)Adds anEdgeto the subgraph.booleancontains(Edge e)Tests whether anEdgeis contained in this subgraphIteratordirEdgeIterator()Returns anIteratorover theDirectedEdges in this graph, in the order in which they were added.IteratoredgeIterator()PlanarGraphgetParent()Gets thePlanarGraphwhich this subgraph is part of.IteratornodeIterator()
-
-
-
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 thePlanarGraphwhich 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 anIteratorover theDirectedEdges 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
-
-