Class Threshold<T extends Comparable<T>>
- java.lang.Object
-
- org.opennms.netmgt.flows.classification.internal.decision.Threshold<T>
-
- Direct Known Subclasses:
Threshold.Address
,Threshold.Port
,Threshold.Protocol
public abstract class Threshold<T extends Comparable<T>> extends Object
Represents a threshold that divides rules sets during decision tree construction and guides tree traversal during classification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Threshold.Address
static class
Threshold.DstAddress
static class
Threshold.DstPort
static class
Threshold.Matches
Holds the result of matching a collection of classification rules against a threshold.static class
Threshold.Order
Indicates the order of a classification request relative to a threshold.static class
Threshold.Port
static class
Threshold.Protocol
static class
Threshold.SrcAddress
static class
Threshold.SrcPort
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canRestrict(Bounds bounds)
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.Bounds
eq(Bounds bounds)
Uses this threshold to restrict the corresponding bound in the given bounds.abstract T
getThreshold()
Bounds
gt(Bounds bounds)
Uses this threshold to restrict the corresponding bound in the given bounds.Bounds
lt(Bounds bounds)
Uses this threshold to restrict the corresponding bound in the given bounds.Threshold.Matches
match(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.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.
-
-
-
Field Detail
-
getBound
protected final java.util.function.Function<Bounds,Bound<T extends Comparable<T>>> getBound
-
-
Method Detail
-
getThreshold
public abstract T getThreshold()
-
match
public Threshold.Matches match(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 theThreshold.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 thresholdThreshold.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.
-
-