Package org.meteoinfo.jts.planargraph
Class Subgraph
- java.lang.Object
-
- org.meteoinfo.jts.planargraph.Subgraph
-
public class Subgraph extends java.lang.ObjectA 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 java.util.ListdirEdgesprotected java.util.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 subgraphjava.util.IteratordirEdgeIterator()Returns anIteratorover theDirectedEdges in this graph, in the order in which they were added.java.util.IteratoredgeIterator()Returns anIteratorover theEdges in this graph, in the order in which they were added.PlanarGraphgetParent()Gets thePlanarGraphwhich this subgraph is part of.java.util.IteratornodeIterator()Returns anIteratorover theNodes in this graph.
-
-
-
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 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 java.util.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)
-
edgeIterator
public java.util.Iterator edgeIterator()
Returns anIteratorover theEdges 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 anIteratorover theNodes in this graph.- Returns:
- an iterator over the nodes
-
-