Remove deprecated LinkWeight interface
Change-Id: I4d3edab133d115ba189f317202d2dfba9b100918
diff --git a/core/api/src/main/java/org/onosproject/net/topology/MetricLinkWeight.java b/core/api/src/main/java/org/onosproject/net/topology/MetricLinkWeight.java
index e24ea4a..e87f660 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/MetricLinkWeight.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/MetricLinkWeight.java
@@ -16,20 +16,32 @@
package org.onosproject.net.topology;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
import org.onosproject.net.AnnotationKeys;
/**
* Link weight for measuring link cost using the link metric annotation.
*/
-public class MetricLinkWeight implements LinkWeight {
+public class MetricLinkWeight implements LinkWeigher {
@Override
- public double weight(TopologyEdge edge) {
+ public Weight getInitialWeight() {
+ return ScalarWeight.toWeight(0.0);
+ }
+
+ @Override
+ public Weight getNonViableWeight() {
+ return ScalarWeight.NON_VIABLE_WEIGHT;
+ }
+
+ @Override
+ public Weight weight(TopologyEdge edge) {
String v = edge.link().annotations().value(AnnotationKeys.METRIC);
try {
- return v != null ? Double.parseDouble(v) : 1;
+ return ScalarWeight.toWeight(v != null ? Double.parseDouble(v) : 1);
} catch (NumberFormatException e) {
- return 1;
+ return ScalarWeight.toWeight(1.0);
}
}
}