Class AnnotationConstraint
- java.lang.Object
-
- org.onosproject.net.intent.constraint.BooleanConstraint
-
- org.onosproject.net.intent.constraint.AnnotationConstraint
-
- All Implemented Interfaces:
Constraint
@Beta public class AnnotationConstraint extends BooleanConstraint
Constraint that evaluates an arbitrary link annotated value is under the specified threshold.
-
-
Constructor Summary
Constructors Constructor Description AnnotationConstraint(String key, double threshold)Creates a new constraint to keep the value for the specified key of link annotation under the threshold.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecost(Link link, ResourceContext context)Evaluates the specified link and provides the cost for its traversal.booleanequals(Object obj)inthashCode()booleanisValid(Link link, ResourceContext context)Returns true if the specified link satisfies the constraint.Stringkey()Returns the key of link annotation this constraint designates.doublethreshold()Returns the threshold this constraint ensures as link annotated value.StringtoString()-
Methods inherited from class org.onosproject.net.intent.constraint.BooleanConstraint
validate
-
-
-
-
Constructor Detail
-
AnnotationConstraint
public AnnotationConstraint(String key, double threshold)
Creates a new constraint to keep the value for the specified key of link annotation under the threshold.- Parameters:
key- key of link annotationthreshold- threshold value of the specified link annotation
-
-
Method Detail
-
key
public String key()
Returns the key of link annotation this constraint designates.- Returns:
- key of link annotation
-
threshold
public double threshold()
Returns the threshold this constraint ensures as link annotated value.- Returns:
- threshold as link annotated value
-
isValid
public boolean isValid(Link link, ResourceContext context)
Description copied from class:BooleanConstraintReturns true if the specified link satisfies the constraint.- Specified by:
isValidin classBooleanConstraint- Parameters:
link- link to be validatedcontext- resource context for checking available resources- Returns:
- true if link is viable
-
cost
public double cost(Link link, ResourceContext context)
Description copied from class:BooleanConstraintEvaluates the specified link and provides the cost for its traversal. Negative return value means the specified link does not satisfy this constraint.- Specified by:
costin interfaceConstraint- Overrides:
costin classBooleanConstraint- Parameters:
link- link to be evaluatedcontext- resource context for validating availability of resources- Returns:
- cost of link traversal
-
-