@Beta public class AnnotationConstraint extends BooleanConstraint
Constructor and Description |
---|
AnnotationConstraint(java.lang.String key,
double threshold)
Creates a new constraint to keep the value for the specified key
of link annotation under the threshold.
|
Modifier and Type | Method and Description |
---|---|
double |
cost(Link link,
ResourceContext context)
Evaluates the specified link and provides the cost for its traversal.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isValid(Link link,
ResourceContext context)
Returns true if the specified link satisfies the constraint.
|
java.lang.String |
key()
Returns the key of link annotation this constraint designates.
|
double |
threshold()
Returns the threshold this constraint ensures as link annotated value.
|
java.lang.String |
toString() |
validate
public AnnotationConstraint(java.lang.String key, double threshold)
key
- key of link annotationthreshold
- threshold value of the specified link annotationpublic java.lang.String key()
public double threshold()
public boolean isValid(Link link, ResourceContext context)
BooleanConstraint
isValid
in class BooleanConstraint
link
- link to be validatedcontext
- resource context for checking available resourcespublic double cost(Link link, ResourceContext context)
BooleanConstraint
cost
in interface Constraint
cost
in class BooleanConstraint
link
- link to be evaluatedcontext
- resource context for validating availability of resourcespublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object