Class Tree

  • Direct Known Subclasses:
    Tree.Leaf, Tree.Node

    public abstract class Tree
    extends Object
    Represents a decision tree for classifying flows.

    The tree consists of nested nodes that define thresholds for various aspects of flows (e.g. source ports or destination addresses) and leaves that contain an ordered lists of classifiers. When a classification request is processed it is compared to thresholds and traversal continues in subtrees corresponding to the comparison result.

    A special twist is that classification rules and classification requests may not contain a value for certain aspects. For example a classification rule may have no ports being set or a classification request may be missing protocol information. This is handled by having child nodes for 'non-applicable' rules and considering 'non-applicable' orderings when comparing a classification request with thresholds (cf. Threshold.compare(ClassificationRequest)).

    • Field Detail

      • EMPTY

        public static final Tree EMPTY
    • Constructor Detail

    • Method Detail

      • classify

        public final String classify​(ClassificationRequest request)
        Classifies a flow.

        Recursively traverses the decision tree and collects applicable classifiers. The collected classifiers are sorted by their priorities and the result of the first matching classifier is returned. In case that several classifiers with the maximum priority match more specific classifiers (i.e. classifiers that consider more aspects of flows) are prefered.

        Returns:
        Returns null if the request does not match a rule
      • accept

        public abstract <T> T accept​(Tree.Visitor<T> visitor)
      • isEmpty

        protected abstract boolean isEmpty()
      • classifiers

        protected abstract org.opennms.netmgt.flows.classification.internal.decision.Tree.Classifiers classifiers​(ClassificationRequest request)
        Returns:
        matching classifiers or null
      • merge

        public static org.opennms.netmgt.flows.classification.internal.decision.Tree.Classifiers merge​(org.opennms.netmgt.flows.classification.internal.decision.Tree.Classifiers i1,
                                                                                                       org.opennms.netmgt.flows.classification.internal.decision.Tree.Classifiers i2)