Package org.onlab.graph
Interface Weight
-
- All Superinterfaces:
java.lang.Comparable<Weight>
- All Known Implementing Classes:
ScalarWeight
public interface Weight extends java.lang.Comparable<Weight>
Abstraction of a graph edge weight.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isNegative()
Returns true if the weight is negative (means that aggregated path cost will decrease if we add weighted subject to it).boolean
isViable()
Returns true if the weighted subject (link/path) can be traversed; false otherwise.Weight
merge(Weight otherWeight)
Merges the given weight with this one returning a new aggregated weight.Weight
subtract(Weight otherWeight)
Subtracts the given weight from this one and produces a new weight.
-
-
-
Method Detail
-
merge
Weight merge(Weight otherWeight)
Merges the given weight with this one returning a new aggregated weight.- Parameters:
otherWeight
- weight to add- Returns:
- aggregated weight
-
subtract
Weight subtract(Weight otherWeight)
Subtracts the given weight from this one and produces a new weight.- Parameters:
otherWeight
- weight to subtract- Returns:
- residual weight
-
isViable
boolean isViable()
Returns true if the weighted subject (link/path) can be traversed; false otherwise.- Returns:
- true if weight is adequate, false if weight is infinite
-
isNegative
boolean isNegative()
Returns true if the weight is negative (means that aggregated path cost will decrease if we add weighted subject to it).- Returns:
- true if the weight is negative, false otherwise
-
-