public abstract class AbstractRule extends java.lang.Object implements IRule
Modifier and Type | Field and Description |
---|---|
private java.util.Collection<TypedPreference<?>> |
configAttributes |
protected java.util.concurrent.FutureTask<IResult> |
evaluationTask |
private java.lang.String |
id |
private java.lang.String |
name |
private java.util.Map<java.lang.String,RulesToolkit.EventAvailability> |
requiredEvents |
private java.util.Collection<TypedResult<?>> |
resultAttributes |
private java.lang.String |
topic |
Constructor and Description |
---|
AbstractRule(java.lang.String id,
java.lang.String name,
java.lang.String topic,
java.util.Collection<TypedPreference<?>> configAttributes,
java.util.Collection<TypedResult<?>> resultAttributes,
java.util.Map<java.lang.String,RulesToolkit.EventAvailability> requiredEvents) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.RunnableFuture<IResult> |
createEvaluation(IItemCollection items,
IPreferenceValueProvider valueProvider,
IResultValueProvider resultProvider)
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.String |
getId() |
java.lang.String |
getName() |
java.util.Map<java.lang.String,RulesToolkit.EventAvailability> |
getRequiredEvents() |
protected abstract IResult |
getResult(IItemCollection items,
IPreferenceValueProvider vp,
IResultValueProvider rp) |
java.util.Collection<TypedResult<?>> |
getResults()
Gets information about which results may be part of an
IResult instance. |
java.lang.String |
getTopic() |
protected java.util.concurrent.FutureTask<IResult> evaluationTask
private final java.lang.String id
private final java.lang.String name
private final java.lang.String topic
private final java.util.Collection<TypedPreference<?>> configAttributes
private final java.util.Collection<TypedResult<?>> resultAttributes
private final java.util.Map<java.lang.String,RulesToolkit.EventAvailability> requiredEvents
public AbstractRule(java.lang.String id, java.lang.String name, java.lang.String topic, java.util.Collection<TypedPreference<?>> configAttributes, java.util.Collection<TypedResult<?>> resultAttributes, java.util.Map<java.lang.String,RulesToolkit.EventAvailability> requiredEvents)
protected abstract IResult getResult(IItemCollection items, IPreferenceValueProvider vp, IResultValueProvider rp)
public java.util.concurrent.RunnableFuture<IResult> createEvaluation(IItemCollection items, IPreferenceValueProvider valueProvider, IResultValueProvider resultProvider)
IRule
createEvaluation
in interface IRule
items
- items to evaluatevalueProvider
- Provider of configuration values used for evaluation. The attributes that will be
asked for from the provider should be provided by
IRule.getConfigurationAttributes()
.resultProvider
- Provider of results from rules evaluated prior to this rule and which this rule
explicitly depends on via a DependsOn
annotation. The attributes that will
be asked for from the provider will be provided by each dependant rule, e.g. via
public static constants.public java.util.Collection<TypedPreference<?>> getConfigurationAttributes()
IRule
getConfigurationAttributes
in interface IRule
public java.lang.String getId()
public java.lang.String getName()
public java.lang.String getTopic()
public java.util.Collection<TypedResult<?>> getResults()
IRule
IResult
instance.getResults
in interface IRule
public java.util.Map<java.lang.String,RulesToolkit.EventAvailability> getRequiredEvents()
getRequiredEvents
in interface IRule
RulesToolkit.EventAvailability
this rule
requires for that event type