Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| xmlgraphics-commons 2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xmlgraphics.util.dijkstra
Class DefaultEdgeDirectory

    java.lang.Object
      org.apache.xmlgraphics.util.dijkstra.DefaultEdgeDirectory

All Implemented Interfaces:
  EdgeDirectory

    public class DefaultEdgeDirectory

extends Object
implements EdgeDirectory

Default implementation of an edge directory for the `DijkstraAlgorithm`.

Constructor Summary
`DefaultEdgeDirectory()`

Method Summary
`void` | `addEdge(Edge edge)` Adds a new edge between two vertices.
`Edge` | `getBestEdge(Vertex start, Vertex end)` Returns the best edge (the edge with the lowest penalty) between two given vertices.
`Iterator` | `getDestinations(Vertex origin)` Returns an iterator over all valid destinations for a given vertex.
`Iterator` | `getEdges(Vertex origin)` Returns an iterator over all edges with the given origin.
`int` | `getPenalty(Vertex start, Vertex end)` Returns the penalty between two vertices.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultEdgeDirectory

    public DefaultEdgeDirectory()

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:
    `getPenalty` in interface `EdgeDirectory`
  Parameters:
    `start` - the start vertex
    `end` - the end vertex
  Returns:
    the penalty between two vertices, or 0 if no single edge between the two vertices exists.

### getDestinations

    public Iterator getDestinations(Vertex origin)

  Returns an iterator over all valid destinations for a given vertex.

  Specified by:
    `getDestinations` in interface `EdgeDirectory`
  Parameters:
    `origin` - the origin from which to search for destinations
  Returns:
    the iterator over all valid destinations for a given vertex

### getEdges

    public Iterator getEdges(Vertex origin)

  Returns an iterator over all edges with the given origin.

  Parameters:
    `origin` - the origin
  Returns:
    an iterator over Edge instances

### getBestEdge

    public Edge getBestEdge(Vertex start,
                            Vertex end)

  Returns the best edge (the edge with the lowest penalty) between two given vertices.

  Parameters:
    `start` - the start vertex
    `end` - the end vertex
  Returns:
    the best vertex or null if none is found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| xmlgraphics-commons 2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2017 The Apache Software Foundation. All Rights Reserved.