Remove deprecated LinkWeight interface

Change-Id: I4d3edab133d115ba189f317202d2dfba9b100918
diff --git a/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java b/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
index 7c831e7..cf9a531 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
@@ -42,7 +42,6 @@
 import java.util.stream.Stream;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 
 /**
  * Helper class for path service.
@@ -60,18 +59,13 @@
     private static final PortNumber P0 = PortNumber.portNumber(0);
 
     protected static final LinkWeigher DEFAULT_WEIGHER =
-            adapt(new HopCountLinkWeight());
+            new HopCountLinkWeigher();
 
     protected TopologyService topologyService;
 
     protected HostService hostService;
 
     @Override
-    public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
-        return getPaths(src, dst, adapt(weight));
-    }
-
-    @Override
     public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
         checkNotNull(src, ELEMENT_ID_NULL);
         checkNotNull(dst, ELEMENT_ID_NULL);
@@ -140,11 +134,6 @@
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) {
-        return getDisjointPaths(src, dst, adapt(weight));
-    }
-
-    @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
         checkNotNull(src, ELEMENT_ID_NULL);
         checkNotNull(dst, ELEMENT_ID_NULL);
@@ -179,12 +168,6 @@
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight,
-                                              Map<Link, Object> riskProfile) {
-        return getDisjointPaths(src, dst, adapt(weight), riskProfile);
-    }
-
-    @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
                                               LinkWeigher weigher, Map<Link, Object> riskProfile) {
         checkNotNull(src, ELEMENT_ID_NULL);
diff --git a/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java b/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java
deleted file mode 100644
index 70260e3..0000000
--- a/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.net.topology;
-
-import org.onlab.graph.DefaultEdgeWeigher;
-import org.onlab.graph.ScalarWeight;
-import org.onlab.graph.Weight;
-
-/**
- * Wrapper which transforms double-based link weigher to {@link Weight}-based
- * link weigher.
- */
-public final class AdapterLinkWeigher
-        extends DefaultEdgeWeigher<TopologyVertex, TopologyEdge>
-        implements LinkWeigher {
-
-    private final LinkWeight doubleWeigher;
-
-    private AdapterLinkWeigher(LinkWeight doubleWeigher) {
-        this.doubleWeigher = doubleWeigher;
-    }
-
-    @Override
-    public Weight weight(TopologyEdge edge) {
-        return new ScalarWeight(doubleWeigher.weight(edge));
-    }
-
-    /**
-     * Transforms double-based link weigher to {@link Weight}-based weigher.
-     *
-     * @param lw double-based weigher
-     * @return {@link Weight}-based weigher
-     */
-    public static LinkWeigher adapt(LinkWeight lw) {
-        return lw == null ? null : new AdapterLinkWeigher(lw);
-    }
-}
diff --git a/core/api/src/main/java/org/onosproject/net/topology/GeoDistanceLinkWeight.java b/core/api/src/main/java/org/onosproject/net/topology/GeoDistanceLinkWeight.java
index f30fc80..9d22b84 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/GeoDistanceLinkWeight.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/GeoDistanceLinkWeight.java
@@ -16,6 +16,8 @@
 
 package org.onosproject.net.topology;
 
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onlab.util.GeoLocation;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.Annotations;
@@ -29,7 +31,7 @@
  * Link weight for measuring link cost using the geo distance between link
  * vertices as determined by the element longitude/latitude annotation.
  */
-public class GeoDistanceLinkWeight implements LinkWeight {
+public class GeoDistanceLinkWeight implements LinkWeigher {
 
     private static final double MAX_KM = 40_075 / 2.0;
 
@@ -45,10 +47,20 @@
     }
 
     @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) {
         GeoLocation src = getLocation(edge.link().src().deviceId());
         GeoLocation dst = getLocation(edge.link().dst().deviceId());
-        return src != null && dst != null ? src.kilometersTo(dst) : MAX_KM;
+        return ScalarWeight.toWeight(src != null && dst != null ? src.kilometersTo(dst) : MAX_KM);
     }
 
     private GeoLocation getLocation(DeviceId deviceId) {
diff --git a/core/api/src/main/java/org/onosproject/net/topology/HopCountLinkWeight.java b/core/api/src/main/java/org/onosproject/net/topology/HopCountLinkWeight.java
deleted file mode 100644
index 885cd67..0000000
--- a/core/api/src/main/java/org/onosproject/net/topology/HopCountLinkWeight.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.topology;
-
-import static org.onosproject.net.Link.State.ACTIVE;
-import static org.onosproject.net.Link.Type.INDIRECT;
-
-/**
- * Link weight for measuring link cost as hop count with indirect links
- * being as expensive as traversing the entire graph to assume the worst.
- */
-public class HopCountLinkWeight implements LinkWeight {
-    private final int indirectLinkCost;
-
-    /**
-     * Creates a new hop-count weight.
-     */
-    public HopCountLinkWeight() {
-        this.indirectLinkCost = Short.MAX_VALUE;
-    }
-
-    /**
-     * Creates a new hop-count weight with the specified cost of indirect links.
-     *
-     * @param indirectLinkCost indirect link cost
-     */
-    public HopCountLinkWeight(int indirectLinkCost) {
-        this.indirectLinkCost = indirectLinkCost;
-    }
-
-    @Override
-    public double weight(TopologyEdge edge) {
-        // To force preference to use direct paths first, make indirect
-        // links as expensive as the linear vertex traversal.
-        return edge.link().state() ==
-                ACTIVE ? (edge.link().type() ==
-                INDIRECT ? indirectLinkCost : 1) : -1;
-    }
-}
-
diff --git a/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java b/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java
deleted file mode 100644
index 944c843..0000000
--- a/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.topology;
-
-/**
- * Entity capable of determining cost or weight of a specified topology
- * graph edge.
- * @deprecated in Junco (1.9.0), use {@link LinkWeigher} instead
- */
-@Deprecated
-public interface LinkWeight {
-
-    /**
-     * Returns the weight of the given edge.
-     *
-     * @param edge edge to be weighed
-     * @return edge weight
-     */
-    double weight(TopologyEdge edge);
-}
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);
         }
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java b/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
index fed0651..fb67c91 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
@@ -28,18 +28,6 @@
      * If null is specified, the builtin default hop-count link-weight will be
      * used.
      *
-     * @param linkWeight default link-weight function
-     *
-     * @deprecated in Junco (1.9.0), use setDefaultLinkWeigher() instead
-     */
-    @Deprecated
-    void setDefaultLinkWeight(LinkWeight linkWeight);
-
-    /**
-     * Sets the specified link-weight function to be used as a default.
-     * If null is specified, the builtin default hop-count link-weight will be
-     * used.
-     *
      * @param linkWeigher link-weight function to be used as default
      */
     void setDefaultLinkWeigher(LinkWeigher linkWeigher);
diff --git a/core/api/src/main/java/org/onosproject/net/topology/PathService.java b/core/api/src/main/java/org/onosproject/net/topology/PathService.java
index ae2de8b..73f0149 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/PathService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/PathService.java
@@ -48,21 +48,6 @@
      * destination network elements.  The path is computed using the supplied
      * edge-weight function.
      *
-     * @param src    source element
-     * @param dst    destination element
-     * @param weight edge-weight entity
-     * @return set of all shortest paths between the two element
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight);
-
-    /**
-     * Returns the set of all shortest paths between the specified source and
-     * destination network elements.  The path is computed using the supplied
-     * edge-weight function.
-     *
      * @param src     source element
      * @param dst     destination element
      * @param weigher edge-weight entity
@@ -113,22 +98,6 @@
      * specified source and destination elements. The path is computed using
      * the supplied edge-weight function.
      *
-     * @param src    source device
-     * @param dst    destination device
-     * @param weight edge-weight entity
-     * @return set of all shortest paths between the two devices
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
-                                       LinkWeight weight);
-
-    /**
-     * Returns the set of all disjoint shortest path pairs between the
-     * specified source and destination elements. The path is computed using
-     * the supplied edge-weight function.
-     *
      * @param src     source device
      * @param dst     destination device
      * @param weigher edge-weight entity
@@ -159,25 +128,6 @@
      *
      * @param src         source device
      * @param dst         destination device
-     * @param weight      edge-weight entity
-     * @param riskProfile map of edges to risk profiles
-     * @return set of all shortest paths between the two devices
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
-                                       LinkWeight weight,
-                                       Map<Link, Object> riskProfile);
-
-    /**
-     * Returns the set of all disjoint shortest path pairs between the
-     * specified source and destination elements and taking into consideration
-     * the provided risk profile. The path is computed using the supplied
-     * edge-weight function.
-     *
-     * @param src         source device
-     * @param dst         destination device
      * @param weigher     edge-weight entity
      * @param riskProfile map of edges to risk profiles
      * @return set of all shortest paths between the two devices
diff --git a/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java b/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
index 6d95a97..ee70ed7 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
@@ -111,22 +111,6 @@
      * @param topology topology descriptor
      * @param src      source device
      * @param dst      destination device
-     * @param weight   edge-weight entity
-     * @return set of all shortest paths between the two devices
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
-                       LinkWeight weight);
-
-    /**
-     * Returns the set of all shortest paths, computed using the supplied
-     * edge-weight entity, between the specified source and destination devices.
-     *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
      * @param weigher  edge-weight entity
      * @return set of all shortest paths between the two devices
      */
@@ -204,22 +188,6 @@
      * @param topology topology descriptor
      * @param src      source device
      * @param dst      destination device
-     * @param weight   edge-weight entity
-     * @return set of all shortest paths between the two devices
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
-                                       LinkWeight weight);
-
-    /**
-     * Returns the set of all disjoint shortest path pairs, computed using the supplied
-     * edge-weight entity, between the specified source and destination devices.
-     *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
      * @param weigher  edge-weight entity
      * @return set of all shortest paths between the two devices
      */
@@ -246,23 +214,6 @@
      * @param topology    topology descriptor
      * @param src         source device
      * @param dst         destination device
-     * @param weight      edge-weight entity
-     * @param riskProfile map of edges to risk profiles
-     * @return set of all shortest paths between the two devices
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
-                                       LinkWeight weight, Map<Link, Object> riskProfile);
-
-    /**
-     * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
-     * between the specified source and destination devices.
-     *
-     * @param topology    topology descriptor
-     * @param src         source device
-     * @param dst         destination device
      * @param weigher     edge-weight entity
      * @param riskProfile map of edges to risk profiles
      * @return set of all shortest paths between the two devices
diff --git a/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java b/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
index 99838c6..17957e1 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
@@ -109,21 +109,6 @@
      * @param topology topology descriptor
      * @param src      source device
      * @param dst      destination device
-     * @param weight   link weight function
-     * @return set of shortest paths
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
-                       LinkWeight weight);
-
-    /**
-     * Computes and returns the set of shortest paths between src and dest.
-     *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
      * @param weigher  link weight function
      * @return set of shortest paths
      */
@@ -176,22 +161,6 @@
      * @param topology topology descriptor
      * @param src      source device
      * @param dst      destination device
-     * @param weight   link weight function
-     * @return set of shortest paths
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
-                                       LinkWeight weight);
-
-    /**
-     * Computes and returns the set of disjoint shortest path pairs
-     * between src and dst.
-     *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
      * @param weigher  link weight function
      * @return set of shortest paths
      */
@@ -216,24 +185,6 @@
      * @param topology    topology descriptor
      * @param src         source device
      * @param dst         destination device
-     * @param weight      link weight function
-     * @param riskProfile map of edges to objects. Edges that map to the same object will
-     * be treated as if they were in the same risk group.
-     * @return set of shortest paths
-     *
-     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
-     */
-    @Deprecated
-    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
-                                       LinkWeight weight, Map<Link, Object> riskProfile);
-
-    /**
-     * Computes and returns the set of SRLG disjoint shortest path pairs between source
-     * and dst, given a mapping of edges to SRLG risk groups.
-     *
-     * @param topology    topology descriptor
-     * @param src         source device
-     * @param dst         destination device
      * @param weigher     link weight function
      * @param riskProfile map of edges to objects. Edges that map to the same object will
      * be treated as if they were in the same risk group.