Package jadex.rules.rulesystem
Class RuleSystem
- java.lang.Object
-
- jadex.rules.rulesystem.RuleSystem
-
public class RuleSystem extends java.lang.ObjectRule system is a container for state, rule base, and pattern matcher with agenda.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleaninitedFlag to check if the rule system was already initialized.protected IPatternMatcherFunctionalitymatcherfuncThe pattern matcher functionality for evaluating rules.protected IPatternMatcherStatematcherstateThe matcher state.protected IRulebaserulebaseThe rule base containing all the rules.protected IOAVStatestateThe 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 voidfireAllRules()Fire all rules until quiescence.IAgendagetAgenda()Get the agenda.IPatternMatcherFunctionalitygetMatcherFunctionality()Get the matcher functionality.IPatternMatcherStategetMatcherState()Get the matcher state.IRulebasegetRulebase()Get the rulebase.IOAVStategetState()Get the memory.voidinit()Initialize the rule system.booleanisInited()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.
-
-