blob: bf3f934f8440470086e82078a45697e4d458f8b0 [file] [log] [blame]
Ray Milkey7483e1b2018-02-07 15:43:01 -08001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.net.topology;
18
19import org.onlab.graph.ScalarWeight;
20import org.onlab.graph.Weight;
21
22public class LinkWeigherAdapter implements LinkWeigher {
23 final double weight;
24
25 public LinkWeigherAdapter(Double weight) {
26 this.weight = weight;
27 }
28 @Override
29 public Weight weight(TopologyEdge edge) {
30 return ScalarWeight.toWeight(weight);
31 }
32
33 @Override
34 public Weight getInitialWeight() {
35 return ScalarWeight.toWeight(0.0);
36 }
37
38 @Override
39 public Weight getNonViableWeight() {
40 return ScalarWeight.toWeight(0.0);
41 }
42}