summaryrefslogtreecommitdiffstats
path: root/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/Weight.java
blob: 73772ed408a5a2b827d840e4d4d794417af70316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.onap.ccsdk.sli.core.slipluginutils.slitopologyutils.graph;

/**
 * Abstraction of a graph edge weight.
 */
public interface Weight extends Comparable<Weight> {

    /**
     * Merges the given weight with this one returning a new aggregated
     * weight.
     *
     * @param otherWeight weight to add
     * @return aggregated weight
     */
    Weight merge(Weight otherWeight);

    /**
     * Subtracts the given weight from this one and produces a new weight.
     *
     * @param otherWeight weight to subtract
     * @return residual weight
     */
    Weight subtract(Weight otherWeight);

    /**
     * Returns true if the weighted subject (link/path) can be traversed; false otherwise.
     *
     * @return true if weight is adequate, false if weight is infinite
     */
    boolean isViable();

    /**
     * Returns true if the weight is negative (means that aggregated
     * path cost will decrease if we add weighted subject to it).
     *
     * @return true if the weight is negative, false otherwise
     */
    boolean isNegative();
}