public abstract class AbstractRuleAdapterRuntime extends Object implements RuleAdapterRuntime
RuleAdapterRuntime.NodeValue| Modifier and Type | Field and Description |
|---|---|
protected BaseRuleAdapter |
adapter |
protected Map<String,Event> |
eventAliasMap
Map of (event alias, event instance).
|
protected Tree<RuleAdapterRuntime.NodeValue> |
eventTree
Event tree.
|
| Constructor and Description |
|---|
AbstractRuleAdapterRuntime(BaseRuleAdapter adapter) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptAsFirst(Event event) |
protected void |
buildEventTree(TreeNode<RuleAdapterRuntime.NodeValue> node,
Event event)
Continues building the event tree for the incoming event starting at the specified node.
|
protected boolean |
checkConditions(TreeNode<RuleAdapterRuntime.NodeValue> node)
Checks conditions for the given node (containing level and event).
|
void |
clear()
Clears event tree and event alias map.
|
protected RuleDefinition |
getDefinition() |
Event |
getEvent(String eventAlias) |
Map<String,Event> |
getEventAliasMap()
Returns event alias map.
|
protected abstract int |
getEventIndex(TreeNode<RuleAdapterRuntime.NodeValue> node) |
protected EventMode |
getEventMode(TreeNode<RuleAdapterRuntime.NodeValue> node)
Returns event mode.
|
List<Event> |
getEventSequence()
Returns event sequence.
|
Tree<RuleAdapterRuntime.NodeValue> |
getEventTree()
Returns the event tree.
|
protected abstract int |
getExpectedEventIndex(TreeNode<RuleAdapterRuntime.NodeValue> node,
Event event) |
Event |
getFirstEvent() |
protected BaseRuleMeta |
getMeta() |
protected boolean |
handleNoneEventHappenedButShouldNot(TreeNode<RuleAdapterRuntime.NodeValue> parentNode,
TreeNode<RuleAdapterRuntime.NodeValue> node,
Event event) |
protected abstract boolean |
isLeafLevel(TreeNode<RuleAdapterRuntime.NodeValue> node) |
void |
onEvent(Event event)
Processes the incoming event.
|
protected void |
prepareEventAliasMap(TreeNode<RuleAdapterRuntime.NodeValue> node)
Clears and sets up event alias map (event alias - event instance).
|
boolean |
runRule()
Attempts to run (fire) this rule.
|
protected boolean |
runRule(TreeNode<RuleAdapterRuntime.NodeValue> node)
Attempts to run (fire) this rule for the specified node in the event tree.
|
protected abstract boolean |
runRuleForNonFinalNode(TreeNode<RuleAdapterRuntime.NodeValue> node) |
protected abstract boolean |
shouldAddToEventTreeForFlaModes(TreeNode<RuleAdapterRuntime.NodeValue> newNode,
Event event) |
protected abstract boolean |
shouldAddToEventTreeForNMode(TreeNode<RuleAdapterRuntime.NodeValue> parentNode,
org.apache.commons.lang3.mutable.Mutable<TreeNode<RuleAdapterRuntime.NodeValue>> newNodeHolder,
Event event)
Checks if the event should be added to the event tree for mode NONE.
|
protected abstract boolean |
shouldRunRule() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisCandidateForFirstEvent, validateprotected BaseRuleAdapter adapter
protected Tree<RuleAdapterRuntime.NodeValue> eventTree
public AbstractRuleAdapterRuntime(BaseRuleAdapter adapter)
protected RuleDefinition getDefinition()
protected BaseRuleMeta getMeta()
protected boolean checkConditions(TreeNode<RuleAdapterRuntime.NodeValue> node)
node - event tree node.true if all conditions are met.public boolean acceptAsFirst(Event event)
acceptAsFirst in interface RuleAdapterRuntimepublic void onEvent(Event event)
onEvent in interface RuleAdapterRuntimeprotected abstract int getEventIndex(TreeNode<RuleAdapterRuntime.NodeValue> node)
protected abstract boolean shouldRunRule()
protected abstract boolean shouldAddToEventTreeForFlaModes(TreeNode<RuleAdapterRuntime.NodeValue> newNode, Event event)
protected abstract int getExpectedEventIndex(TreeNode<RuleAdapterRuntime.NodeValue> node, Event event)
protected abstract boolean shouldAddToEventTreeForNMode(TreeNode<RuleAdapterRuntime.NodeValue> parentNode, org.apache.commons.lang3.mutable.Mutable<TreeNode<RuleAdapterRuntime.NodeValue>> newNodeHolder, Event event)
parentNode - parent event tree node.newNodeHolder - new event tree node holder.event - new event.true if the event should be added to the event tree.protected void buildEventTree(TreeNode<RuleAdapterRuntime.NodeValue> node, Event event)
node - event tree node.event - incoming event.protected EventMode getEventMode(TreeNode<RuleAdapterRuntime.NodeValue> node)
node - event tree node.public boolean runRule()
runRule in interface RuleAdapterRuntimetrue if this rule has been run all times it ought to. In that case it will be finished.protected boolean runRule(TreeNode<RuleAdapterRuntime.NodeValue> node)
node - event tree node.true if this rule has been run (fired) all times it ought to. In that case it will be finished.protected abstract boolean isLeafLevel(TreeNode<RuleAdapterRuntime.NodeValue> node)
protected abstract boolean runRuleForNonFinalNode(TreeNode<RuleAdapterRuntime.NodeValue> node)
public void clear()
clear in interface RuleAdapterRuntimepublic Event getEvent(String eventAlias)
getEvent in interface RuleAdapterRuntimeprotected void prepareEventAliasMap(TreeNode<RuleAdapterRuntime.NodeValue> node)
node - the node for the last event.public Tree<RuleAdapterRuntime.NodeValue> getEventTree()
getEventTree in interface RuleAdapterRuntimepublic Map<String,Event> getEventAliasMap()
getEventAliasMap in interface RuleAdapterRuntimepublic List<Event> getEventSequence()
getEventSequence in interface RuleAdapterRuntimepublic Event getFirstEvent()
getFirstEvent in interface RuleAdapterRuntimeprotected boolean handleNoneEventHappenedButShouldNot(TreeNode<RuleAdapterRuntime.NodeValue> parentNode, TreeNode<RuleAdapterRuntime.NodeValue> node, Event event)
Copyright © 2016–2019 Softelnet. All rights reserved.