public class RuleSystem
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
context
The context for rule action execution.
|
protected java.util.logging.Logger |
logger
The logger for rule warnings.
|
protected PropertyChangeManager |
pcman
The PropertyChangeManager to add/remove handlers and manage events
|
protected boolean |
processall
Flag to check if currently in processAllEvents (hack?).
|
protected boolean |
queueevents
The execution mode (direct vs queue).
|
protected IRulebase |
rulebase
The rulebase.
|
protected java.util.IdentityHashMap<java.lang.Object,jadex.commons.Tuple2<java.lang.Object,IRule<?>[]>> |
rules
The rules generated for an object.
|
Constructor and Description |
---|
RuleSystem(java.lang.Object context)
Create a new rule system.
|
RuleSystem(java.lang.Object context,
java.util.logging.Logger logger,
boolean queueevents)
Create a new rule system.
|
Modifier and Type | Method and Description |
---|---|
jadex.commons.future.IFuture<java.lang.Void> |
addEvent(IEvent event)
Add an event.
|
protected void |
analyzeMethod(java.lang.reflect.Method method,
java.lang.Object object,
java.util.Map<java.lang.reflect.Method,jadex.commons.IResultCommand<?,?>> eventcreators,
java.util.Map<java.lang.String,Rule<?>> rules)
Inspects a method for
- condition annotation
- action annotation
|
IRulebase |
getRulebase()
Get the rulebase.
|
boolean |
isEventAvailable()
Test if at least one event is available.
|
boolean |
isQueueEvents()
Get the queueevents.
|
java.lang.Object |
observeObject(java.lang.Object object,
boolean bean,
boolean hasrules,
jadex.commons.IResultCommand<jadex.commons.future.IFuture<java.lang.Void>,jadex.commons.beans.PropertyChangeEvent> eventadder)
Monitor an object to the rule engine.
|
jadex.commons.future.IFuture<java.lang.Void> |
processAllEvents()
Process events until the event queue is empty or max
events have been processed.
|
jadex.commons.future.IIntermediateFuture<RuleEvent> |
processEvent()
Process the next event by
- finding rules that are sensible to the event type
- evaluate the conditions of these conditions
- fire actions of triggered rules.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
processRules(IRule<?>[] rules,
int i,
IEvent event,
jadex.commons.future.IntermediateFuture<RuleEvent> res)
Process a given rule set.
|
void |
setQueueEvents(boolean queueevents)
The queueevents to set.
|
void |
unobserveObject(java.lang.Object object,
jadex.commons.IResultCommand<jadex.commons.future.IFuture<java.lang.Void>,jadex.commons.beans.PropertyChangeEvent> eventadder)
Unobserve an object.
|
protected IRulebase rulebase
protected java.util.IdentityHashMap<java.lang.Object,jadex.commons.Tuple2<java.lang.Object,IRule<?>[]>> rules
protected java.lang.Object context
protected java.util.logging.Logger logger
protected PropertyChangeManager pcman
protected boolean queueevents
protected boolean processall
public RuleSystem(java.lang.Object context)
public RuleSystem(java.lang.Object context, java.util.logging.Logger logger, boolean queueevents)
public IRulebase getRulebase()
public jadex.commons.future.IIntermediateFuture<RuleEvent> processEvent()
protected jadex.commons.future.IFuture<java.lang.Void> processRules(IRule<?>[] rules, int i, IEvent event, jadex.commons.future.IntermediateFuture<RuleEvent> res)
public jadex.commons.future.IFuture<java.lang.Void> processAllEvents()
public jadex.commons.future.IFuture<java.lang.Void> addEvent(IEvent event)
public boolean isEventAvailable()
public boolean isQueueEvents()
public void setQueueEvents(boolean queueevents)
queueevents
- The queueevents to setpublic java.lang.Object observeObject(java.lang.Object object, boolean bean, boolean hasrules, jadex.commons.IResultCommand<jadex.commons.future.IFuture<java.lang.Void>,jadex.commons.beans.PropertyChangeEvent> eventadder)
public void unobserveObject(java.lang.Object object, jadex.commons.IResultCommand<jadex.commons.future.IFuture<java.lang.Void>,jadex.commons.beans.PropertyChangeEvent> eventadder)
protected void analyzeMethod(java.lang.reflect.Method method, java.lang.Object object, java.util.Map<java.lang.reflect.Method,jadex.commons.IResultCommand<?,?>> eventcreators, java.util.Map<java.lang.String,Rule<?>> rules)