public class RuleBase
extends java.lang.Object
EventRealm
and it is responsible for creating, managing and disposing rules
in the Rule Engine. It provides an unmodifiable view for the collection of applicable activations.Modifier and Type | Field and Description |
---|---|
protected Agenda |
agenda |
protected EventRealm |
eventRealm |
protected org.apache.log4j.Logger |
logger |
protected com.google.common.collect.Table<RuleSpecification<?>,EventFilter<?>,RuleInstance<?>> |
ruleInstanceTable |
Modifier | Constructor and Description |
---|---|
protected |
RuleBase(EventRealm eventRealm,
Agenda agenda)
Instantiates a new RuleBase instance with the given
EventRealm and Agenda . |
Modifier and Type | Method and Description |
---|---|
ScopedConflictSet |
createScopedConflictSet(ConflictResolver conflictResolver,
com.google.common.collect.Multimap<RuleSpecification<?>,EventFilter<?>> specifications)
Creates a scoped conflict set of the enabled activations of the provided rule specifications and filters using
the given conflict resolver.
|
protected void |
dispose()
Disposes of each rule instance managed by the agenda.
|
protected <EventAtom> |
findInstance(RuleSpecification<EventAtom> specification,
EventFilter<? super EventAtom> filter) |
Agenda |
getAgenda() |
EventRealm |
getEventRealm() |
<EventAtom> |
getInstance(RuleSpecification<EventAtom> specification,
EventFilter<? super EventAtom> filter)
Returns the filtered instance managed by the RuleBase for the given specification.
|
org.apache.log4j.Logger |
getLogger() |
java.util.Set<RuleInstance<?>> |
getRuleInstances() |
com.google.common.collect.Multimap<RuleSpecification<?>,EventFilter<?>> |
getRuleSpecificationMultimap() |
protected <EventAtom> |
instantiateRule(RuleSpecification<EventAtom> specification,
EventFilter<? super EventAtom> filter)
Instantiates the given specification over the EventRealm of the RuleBase.
|
protected <EventAtom> |
removeRule(RuleInstance<EventAtom> instance)
Removes and disposes of a rule instance.
|
protected <EventAtom> |
removeRule(RuleSpecification<EventAtom> specification,
EventFilter<? super EventAtom> filter)
Removes and disposes of a rule instance with the given specification.
|
protected final EventRealm eventRealm
protected final com.google.common.collect.Table<RuleSpecification<?>,EventFilter<?>,RuleInstance<?>> ruleInstanceTable
protected final Agenda agenda
protected final org.apache.log4j.Logger logger
protected RuleBase(EventRealm eventRealm, Agenda agenda)
EventRealm
and Agenda
.eventRealm
- the EventRealm
instanceagenda
- the Agenda
instanceprotected <EventAtom> RuleInstance<EventAtom> instantiateRule(RuleSpecification<EventAtom> specification, EventFilter<? super EventAtom> filter)
specification
- the rule to be instantiatedprotected <EventAtom> boolean removeRule(RuleInstance<EventAtom> instance)
instance
- protected <EventAtom> boolean removeRule(RuleSpecification<EventAtom> specification, EventFilter<? super EventAtom> filter)
specification
- filter
- the partial match used as filterprotected void dispose()
public EventRealm getEventRealm()
public com.google.common.collect.Multimap<RuleSpecification<?>,EventFilter<?>> getRuleSpecificationMultimap()
public java.util.Set<RuleInstance<?>> getRuleInstances()
public <EventAtom> RuleInstance<EventAtom> getInstance(RuleSpecification<EventAtom> specification, EventFilter<? super EventAtom> filter)
specification
- filter
- the partial match to be used as filterprotected <EventAtom> RuleInstance<EventAtom> findInstance(RuleSpecification<EventAtom> specification, EventFilter<? super EventAtom> filter)
public ScopedConflictSet createScopedConflictSet(ConflictResolver conflictResolver, com.google.common.collect.Multimap<RuleSpecification<?>,EventFilter<?>> specifications)
conflictResolver
- specifications
- public Agenda getAgenda()
public org.apache.log4j.Logger getLogger()