Class AbstractRule
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.AbstractRule
-
- All Implemented Interfaces:
IRule
- Direct Known Subclasses:
ApplicationHaltsRule,AutoBoxingRule,CompareCpuRule,FewSampledThreadsRule,GcFreedRatioRule,GcPauseRatioRule,StringDeduplicationRule
public abstract class AbstractRule extends java.lang.Object implements IRule
Abstract base class for rules, supplying some boiler plate code.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<TypedPreference<?>>configAttributesprotected java.util.concurrent.FutureTask<Result>evaluationTaskprivate java.lang.Stringidprivate java.lang.Stringnameprivate java.lang.Stringtopic
-
Constructor Summary
Constructors Constructor Description AbstractRule(java.lang.String id, java.lang.String name, java.lang.String topic, TypedPreference<?>... configAttributes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.RunnableFuture<Result>evaluate(IItemCollection items, IPreferenceValueProvider valueProvider)Gets a future representing the result of the evaluation of this rule.java.util.Collection<TypedPreference<?>>getConfigurationAttributes()Gets information about which attributes may be configured during rule evaluation.java.lang.StringgetId()java.lang.StringgetName()protected abstract ResultgetResult(IItemCollection items, IPreferenceValueProvider vp)java.lang.StringgetTopic()
-
-
-
Field Detail
-
evaluationTask
protected java.util.concurrent.FutureTask<Result> evaluationTask
-
id
private final java.lang.String id
-
name
private final java.lang.String name
-
topic
private final java.lang.String topic
-
configAttributes
private final java.util.Collection<TypedPreference<?>> configAttributes
-
-
Constructor Detail
-
AbstractRule
public AbstractRule(java.lang.String id, java.lang.String name, java.lang.String topic, TypedPreference<?>... configAttributes)
-
-
Method Detail
-
getResult
protected abstract Result getResult(IItemCollection items, IPreferenceValueProvider vp)
-
evaluate
public java.util.concurrent.RunnableFuture<Result> evaluate(IItemCollection items, IPreferenceValueProvider valueProvider)
Description copied from interface:IRuleGets a future representing the result of the evaluation of this rule. Running the RunnableFuture is the responsibility of the caller of this method, not the implementation.- Specified by:
evaluatein interfaceIRule- Parameters:
items- items to evaluatevalueProvider- Provider of configuration values used for evaluation. The attributes that will be asked for from the provider should be provided byIRule.getConfigurationAttributes().- Returns:
- a RunnableFuture that when run will return the evaluation result
-
getConfigurationAttributes
public java.util.Collection<TypedPreference<?>> getConfigurationAttributes()
Description copied from interface:IRuleGets information about which attributes may be configured during rule evaluation.- Specified by:
getConfigurationAttributesin interfaceIRule- Returns:
- a list of configuration attributes
-
getId
public java.lang.String getId()
-
getName
public java.lang.String getName()
-
-