Package jadex.rules.rulesystem
Class RuleSystem
- java.lang.Object
-
- jadex.rules.rulesystem.RuleSystem
-
public class RuleSystem extends java.lang.Object
Rule system is a container for state, rule base, and pattern matcher with agenda.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
inited
Flag to check if the rule system was already initialized.protected IPatternMatcherFunctionality
matcherfunc
The pattern matcher functionality for evaluating rules.protected IPatternMatcherState
matcherstate
The matcher state.protected IRulebase
rulebase
The rule base containing all the rules.protected IOAVState
state
The working memory containing all facts.
-
Constructor Summary
Constructors Constructor Description RuleSystem(IOAVState state, IRulebase rulebase, IPatternMatcherFunctionality matcherfunc)
Create a new rule system.RuleSystem(IOAVState state, IRulebase rulebase, IPatternMatcherFunctionality matcherfunc, AbstractAgenda agenda)
Create a new rule system.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fireAllRules()
Fire all rules until quiescence.IAgenda
getAgenda()
Get the agenda.IPatternMatcherFunctionality
getMatcherFunctionality()
Get the matcher functionality.IPatternMatcherState
getMatcherState()
Get the matcher state.IRulebase
getRulebase()
Get the rulebase.IOAVState
getState()
Get the memory.void
init()
Initialize the rule system.boolean
isInited()
Get the inited.
-
-
-
Field Detail
-
state
protected IOAVState state
The working memory containing all facts.
-
rulebase
protected IRulebase rulebase
The rule base containing all the rules.
-
matcherfunc
protected IPatternMatcherFunctionality matcherfunc
The pattern matcher functionality for evaluating rules.
-
matcherstate
protected IPatternMatcherState matcherstate
The matcher state.
-
inited
protected boolean inited
Flag to check if the rule system was already initialized.
-
-
Constructor Detail
-
RuleSystem
public RuleSystem(IOAVState state, IRulebase rulebase, IPatternMatcherFunctionality matcherfunc)
Create a new rule system.
-
RuleSystem
public RuleSystem(IOAVState state, IRulebase rulebase, IPatternMatcherFunctionality matcherfunc, AbstractAgenda agenda)
Create a new rule system.
-
-
Method Detail
-
init
public void init()
Initialize the rule system. The rule system needs to be initialized once, before rules can be fired. When trying to initialize the rule system twice, an exception is thrown. Exceptions are also thrown, when trying to fire rules of a not yet initialized rule system
-
isInited
public boolean isInited()
Get the inited.- Returns:
- the inited.
-
getState
public IOAVState getState()
Get the memory.- Returns:
- The memory.
-
getRulebase
public IRulebase getRulebase()
Get the rulebase.- Returns:
- The rulebase.
-
getAgenda
public IAgenda getAgenda()
Get the agenda. The agenda can only be accessed, after the rule system has been initialized withinit()
.- Returns:
- The agenda.
-
fireAllRules
public void fireAllRules()
Fire all rules until quiescence.
-
getMatcherFunctionality
public IPatternMatcherFunctionality getMatcherFunctionality()
Get the matcher functionality.- Returns:
- The matcher functionality.
-
getMatcherState
public IPatternMatcherState getMatcherState()
Get the matcher state.- Returns:
- The matcher state.
-
-