org.openstreetmap.josm.actions
Class CombineWayAction.NodeGraph

java.lang.Object
  extended by org.openstreetmap.josm.actions.CombineWayAction.NodeGraph
Enclosing class:
CombineWayAction

public static class CombineWayAction.NodeGraph
extends java.lang.Object


Field Summary
private  java.util.Set<CombineWayAction.NodePair> edges
           
private  int numUndirectedEges
           
private  java.util.HashMap<Node,java.util.List<CombineWayAction.NodePair>> predecessors
           
private  java.util.HashMap<Node,java.util.List<CombineWayAction.NodePair>> successors
           
 
Constructor Summary
CombineWayAction.NodeGraph()
           
 
Method Summary
 void add(CombineWayAction.NodePair pair)
           
 void add(java.util.List<CombineWayAction.NodePair> pairs)
           
static java.util.List<CombineWayAction.NodePair> buildNodePairs(java.util.List<Way> ways, boolean directed)
           
static java.util.List<CombineWayAction.NodePair> buildNodePairs(Way way, boolean directed)
           
protected  java.util.List<Node> buildPathFromNodePairs(java.util.Stack<CombineWayAction.NodePair> path)
           
 java.util.List<Node> buildSpanningPath()
          Tries to find a path through the graph which visits each edge (i.e.
protected  java.util.List<Node> buildSpanningPath(Node startNode)
          Tries to find a spanning path starting from node startNode.
static CombineWayAction.NodeGraph createDirectedGraphFromNodePairs(java.util.List<CombineWayAction.NodePair> pairs)
           
static CombineWayAction.NodeGraph createDirectedGraphFromWays(java.util.Collection<Way> ways)
           
static CombineWayAction.NodeGraph createUndirectedGraphFromNodeList(java.util.List<CombineWayAction.NodePair> pairs)
           
static CombineWayAction.NodeGraph createUndirectedGraphFromNodeWays(java.util.Collection<Way> ways)
           
static java.util.List<CombineWayAction.NodePair> eliminateDuplicateNodePairs(java.util.List<CombineWayAction.NodePair> pairs)
           
protected  java.util.Set<Node> getNodes()
           
protected  java.util.Set<Node> getNodes(java.util.Stack<CombineWayAction.NodePair> pairs)
           
protected  java.util.List<CombineWayAction.NodePair> getOutboundPairs(CombineWayAction.NodePair pair)
           
protected  java.util.List<CombineWayAction.NodePair> getOutboundPairs(Node node)
           
protected  Node getStartNode()
           
protected  java.util.Set<Node> getTerminalNodes()
           
protected  boolean isSpanningWay(java.util.Stack<CombineWayAction.NodePair> way)
           
protected  boolean isTerminalNode(Node n)
           
protected  void prepare()
           
protected  void rememberPredecessors(CombineWayAction.NodePair pair)
           
protected  void rememberSuccessor(CombineWayAction.NodePair pair)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

edges

private java.util.Set<CombineWayAction.NodePair> edges

numUndirectedEges

private int numUndirectedEges

successors

private java.util.HashMap<Node,java.util.List<CombineWayAction.NodePair>> successors

predecessors

private java.util.HashMap<Node,java.util.List<CombineWayAction.NodePair>> predecessors
Constructor Detail

CombineWayAction.NodeGraph

public CombineWayAction.NodeGraph()
Method Detail

buildNodePairs

public static java.util.List<CombineWayAction.NodePair> buildNodePairs(Way way,
                                                                       boolean directed)

buildNodePairs

public static java.util.List<CombineWayAction.NodePair> buildNodePairs(java.util.List<Way> ways,
                                                                       boolean directed)

eliminateDuplicateNodePairs

public static java.util.List<CombineWayAction.NodePair> eliminateDuplicateNodePairs(java.util.List<CombineWayAction.NodePair> pairs)

createDirectedGraphFromNodePairs

public static CombineWayAction.NodeGraph createDirectedGraphFromNodePairs(java.util.List<CombineWayAction.NodePair> pairs)

createDirectedGraphFromWays

public static CombineWayAction.NodeGraph createDirectedGraphFromWays(java.util.Collection<Way> ways)

createUndirectedGraphFromNodeList

public static CombineWayAction.NodeGraph createUndirectedGraphFromNodeList(java.util.List<CombineWayAction.NodePair> pairs)

createUndirectedGraphFromNodeWays

public static CombineWayAction.NodeGraph createUndirectedGraphFromNodeWays(java.util.Collection<Way> ways)

rememberSuccessor

protected void rememberSuccessor(CombineWayAction.NodePair pair)

rememberPredecessors

protected void rememberPredecessors(CombineWayAction.NodePair pair)

isTerminalNode

protected boolean isTerminalNode(Node n)

prepare

protected void prepare()

add

public void add(CombineWayAction.NodePair pair)

add

public void add(java.util.List<CombineWayAction.NodePair> pairs)

getStartNode

protected Node getStartNode()

getTerminalNodes

protected java.util.Set<Node> getTerminalNodes()

getNodes

protected java.util.Set<Node> getNodes(java.util.Stack<CombineWayAction.NodePair> pairs)

getOutboundPairs

protected java.util.List<CombineWayAction.NodePair> getOutboundPairs(CombineWayAction.NodePair pair)

getOutboundPairs

protected java.util.List<CombineWayAction.NodePair> getOutboundPairs(Node node)

getNodes

protected java.util.Set<Node> getNodes()

isSpanningWay

protected boolean isSpanningWay(java.util.Stack<CombineWayAction.NodePair> way)

buildPathFromNodePairs

protected java.util.List<Node> buildPathFromNodePairs(java.util.Stack<CombineWayAction.NodePair> path)

buildSpanningPath

protected java.util.List<Node> buildSpanningPath(Node startNode)
Tries to find a spanning path starting from node startNode. Traverses the path in depth-first order.

Parameters:
startNode - the start node
Returns:
the spanning path; null, if no path is found

buildSpanningPath

public java.util.List<Node> buildSpanningPath()
Tries to find a path through the graph which visits each edge (i.e. the segment of a way) exactly one.

Returns:
the path; null, if no path was found


JOSM