}
private ImageProviderPipeline findPipeline(DefaultEdgeDirectory dir,
ImageFlavor originFlavor, ImageRepresentation destination) {
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(
dir);
ImageRepresentation origin = new ImageRepresentation(originFlavor);
dijkstra.execute(origin, destination);
if (log.isTraceEnabled()) {
log.trace("Lowest penalty: " + dijkstra.getLowestPenalty(destination));
}
Vertex prev = destination;
Vertex pred = dijkstra.getPredecessor(destination);
if (pred == null) {
if (log.isTraceEnabled()) {
log.trace("No route found!");
}
return null;
} else {
LinkedList stops = new LinkedList();
while ((pred = dijkstra.getPredecessor(prev)) != null) {
ImageConversionEdge edge = (ImageConversionEdge)
dir.getBestEdge(pred, prev);
stops.addFirst(edge);
prev = pred;
}