Class AbstractRule
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.AbstractRule
-
-
Field Summary
Fields Modifier and Type Field Description protected FutureTask<IResult>
evaluationTask
-
Constructor Summary
Constructors Constructor Description AbstractRule(String id, String name, String topic, Collection<TypedPreference<?>> configAttributes, Collection<TypedResult<?>> resultAttributes, Map<String,RulesToolkit.EventAvailability> requiredEvents)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RunnableFuture<IResult>
createEvaluation(IItemCollection items, IPreferenceValueProvider valueProvider, IResultValueProvider resultProvider)
Gets a future representing the result of the evaluation of this rule.Collection<TypedPreference<?>>
getConfigurationAttributes()
Gets information about which attributes may be configured during rule evaluation.String
getId()
String
getName()
Map<String,RulesToolkit.EventAvailability>
getRequiredEvents()
protected abstract IResult
getResult(IItemCollection items, IPreferenceValueProvider vp, IResultValueProvider rp)
Collection<TypedResult<?>>
getResults()
Gets information about which results may be part of anIResult
instance.String
getTopic()
-
-
-
Field Detail
-
evaluationTask
protected FutureTask<IResult> evaluationTask
-
-
Constructor Detail
-
AbstractRule
public AbstractRule(String id, String name, String topic, Collection<TypedPreference<?>> configAttributes, Collection<TypedResult<?>> resultAttributes, Map<String,RulesToolkit.EventAvailability> requiredEvents)
-
-
Method Detail
-
getResult
protected abstract IResult getResult(IItemCollection items, IPreferenceValueProvider vp, IResultValueProvider rp)
-
createEvaluation
public RunnableFuture<IResult> createEvaluation(IItemCollection items, IPreferenceValueProvider valueProvider, IResultValueProvider resultProvider)
Description copied from interface:IRule
Gets 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:
createEvaluation
in 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()
.resultProvider
- Provider of results from rules evaluated prior to this rule and which this rule explicitly depends on via aDependsOn
annotation. The attributes that will be asked for from the provider will be provided by each dependant rule, e.g. via public static constants.- Returns:
- a RunnableFuture that when run will return the evaluation result
-
getConfigurationAttributes
public Collection<TypedPreference<?>> getConfigurationAttributes()
Description copied from interface:IRule
Gets information about which attributes may be configured during rule evaluation.- Specified by:
getConfigurationAttributes
in interfaceIRule
- Returns:
- a list of configuration attributes
-
getId
public String getId()
-
getName
public String getName()
-
getTopic
public String getTopic()
-
getResults
public Collection<TypedResult<?>> getResults()
Description copied from interface:IRule
Gets information about which results may be part of anIResult
instance.- Specified by:
getResults
in interfaceIRule
- Returns:
- a list of result attributes
-
getRequiredEvents
public Map<String,RulesToolkit.EventAvailability> getRequiredEvents()
- Specified by:
getRequiredEvents
in interfaceIRule
- Returns:
- a map of all event type IDs and the minimum
RulesToolkit.EventAvailability
this rule requires for that event type
-
-