Class Threshold<T extends java.lang.Comparable<T>>

  • Direct Known Subclasses:
    Threshold.Address, Threshold.Port, Threshold.Protocol

    public abstract class Threshold<T extends java.lang.Comparable<T>>
    extends java.lang.Object
    Represents a threshold that divides rules sets during decision tree construction and guides tree traversal during classification.
    • Field Detail

      • getBound

        protected final java.util.function.Function<Bounds,​Bound<T extends java.lang.Comparable<T>>> getBound
    • Constructor Detail

      • Threshold

        public Threshold​(java.util.function.Function<Bounds,​Bound<T>> getBound,
                         java.util.function.BiFunction<Bounds,​Bound<T>,​Bounds> setBound)
    • Method Detail

      • getThreshold

        public abstract T getThreshold()
      • match

        public Threshold.Matches match​(java.util.Collection<PreprocessedRule> ruleSet,
                                       Bounds bounds)
        Checks for every rule if it matches values that are less than, equal to, or greater than this threshold and adds that rule the corresponding collections. Rules that do not have a value corresponding to this threshold are added to the Threshold.Matches.na collection.

        This method is used to build a decision tree for rule sets.

        Note: A rule may be added to more than one collection. For example rules may cover IP address ranges that include an address threshold. In that case the rule is added to the lt, eq, and gt collections.

      • compare

        public abstract Threshold.Order compare​(ClassificationRequest request)
        Checks if the given request has a value that is less than, equal to, or greater than the threshold value. In case that the given request has no value that corresponds to this threshold Threshold.Order.NA is returned.
      • canRestrict

        public final boolean canRestrict​(Bounds bounds)
      • lt

        public final Bounds lt​(Bounds bounds)
        Uses this threshold to restrict the corresponding bound in the given bounds.
      • eq

        public final Bounds eq​(Bounds bounds)
        Uses this threshold to restrict the corresponding bound in the given bounds.
      • gt

        public final Bounds gt​(Bounds bounds)
        Uses this threshold to restrict the corresponding bound in the given bounds.
      • match

        protected abstract org.opennms.netmgt.flows.classification.internal.decision.Threshold.Match match​(PreprocessedRule rule,
                                                                                                           Bounds bounds)
        Checks if the given rule matches values that are less than, equal to, or greater than this threshold.

        The given bounds are also considered. A rule matches only if it specifies values within the given bounds.