Class DefaultEdgeDirectory
- java.lang.Object
-
- org.apache.xmlgraphics.util.dijkstra.DefaultEdgeDirectory
-
- All Implemented Interfaces:
EdgeDirectory
public class DefaultEdgeDirectory extends java.lang.Object implements EdgeDirectory
Default implementation of an edge directory for theDijkstraAlgorithm.
-
-
Constructor Summary
Constructors Constructor Description DefaultEdgeDirectory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(Edge edge)Adds a new edge between two vertices.EdgegetBestEdge(Vertex start, Vertex end)Returns the best edge (the edge with the lowest penalty) between two given vertices.java.util.IteratorgetDestinations(Vertex origin)Returns an iterator over all valid destinations for a given vertex.java.util.IteratorgetEdges(Vertex origin)Returns an iterator over all edges with the given origin.intgetPenalty(Vertex start, Vertex end)Returns the penalty between two vertices.
-
-
-
Method Detail
-
addEdge
public void addEdge(Edge edge)
Adds a new edge between two vertices.- Parameters:
edge- the new edge
-
getPenalty
public int getPenalty(Vertex start, Vertex end)
Returns the penalty between two vertices.- Specified by:
getPenaltyin interfaceEdgeDirectory- Parameters:
start- the start vertexend- the end vertex- Returns:
- the penalty between two vertices, or 0 if no single edge between the two vertices exists.
-
getDestinations
public java.util.Iterator getDestinations(Vertex origin)
Returns an iterator over all valid destinations for a given vertex.- Specified by:
getDestinationsin interfaceEdgeDirectory- Parameters:
origin- the origin from which to search for destinations- Returns:
- the iterator over all valid destinations for a given vertex
-
getEdges
public java.util.Iterator getEdges(Vertex origin)
Returns an iterator over all edges with the given origin.- Parameters:
origin- the origin- Returns:
- an iterator over Edge instances
-
-