use of org.onlab.graph.Weight in project onos by opennetworkinglab.
the class AbstractPathService method edgeToEdgePath.
// Produces a direct edge-to-edge path.
private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path, LinkWeigher weigher) {
List<Link> links = Lists.newArrayListWithCapacity(2);
Weight cost = weigher.getInitialWeight();
// add the infrastructure path only if it is not null.
if (srcLink != NOT_HOST) {
links.add(srcLink);
cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, srcLink)));
}
if (path != null) {
links.addAll(path.links());
cost = cost.merge(path.weight());
}
if (dstLink != NOT_HOST) {
links.add(dstLink);
cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, dstLink)));
}
return new DefaultPath(PID, links, cost);
}
Aggregations