Class 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​(java.lang.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
      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()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AnnotationConstraint

        public 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.
        Parameters:
        key - key of link annotation
        threshold - threshold value of the specified link annotation
    • Method Detail

      • key

        public java.lang.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: BooleanConstraint
        Returns true if the specified link satisfies the constraint.
        Specified by:
        isValid in class BooleanConstraint
        Parameters:
        link - link to be validated
        context - resource context for checking available resources
        Returns:
        true if link is viable
      • cost

        public double cost​(Link link,
                           ResourceContext context)
        Description copied from class: BooleanConstraint
        Evaluates the specified link and provides the cost for its traversal. Negative return value means the specified link does not satisfy this constraint.
        Specified by:
        cost in interface Constraint
        Overrides:
        cost in class BooleanConstraint
        Parameters:
        link - link to be evaluated
        context - resource context for validating availability of resources
        Returns:
        cost of link traversal
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object