public class Tool4ExpertSystemDeterministic extends Tool4ExpertSystem
Tool4ExpertSystem
class provides the functions of an expert system with deterministic rules.
title: SystemCoreExpLib
description:
copyright: (c) 2013 thomas kaffka, born at 11/08/1959 in düsseldorf - germany , all rights reserved.
Modifier and Type | Field and Description |
---|---|
static int |
ATTRIBUTE |
static int |
ATTRIBUTE_ANSWER |
static int |
END |
Constructor and Description |
---|
Tool4ExpertSystemDeterministic(n4e.core.list.List4SysUser sysUser,
java.lang.String database,
boolean debug)
The constructor
Tool4ExpertSystem creates a new instance(object) of the class. |
Modifier and Type | Method and Description |
---|---|
boolean |
evaluateBoolean(java.lang.String att_uid,
java.lang.String operator,
java.lang.String soperand)
The method
evaluateBoolean evaluates a boolean condition. |
boolean |
evaluateCondition(java.lang.String cond_uid)
The method
evaluateCondition evaluates a condition. |
boolean |
evaluateFloat(java.lang.String att_uid,
java.lang.String operator,
java.lang.String soperand)
The method
evaluateFloat evaluates a float condition. |
boolean |
evaluateInteger(java.lang.String att_uid,
java.lang.String operator,
java.lang.String soperand)
The method
evaluateInteger evaluates an integer condition. |
void |
evaluateRule(java.lang.String rule_uid)
The method
evaluateRule evaluates the rule. |
boolean |
evaluateSet(java.lang.String att_uid,
java.lang.String operator,
java.lang.String soperand)
The method
evaluateSet evaluates a set condition. |
boolean |
evaluateString(java.lang.String att_uid,
java.lang.String operator,
java.lang.String soperand)
The method
evaluateString evaluates a string condition. |
java.lang.String |
getCurrRule()
The method
getCurrRule gets the current rule. |
n4e.core.system.Stack |
getGoalStack()
The method
getGoalStack gets the goal stack. |
java.lang.String |
getRuleEmptyAtt(java.lang.String rule_uid)
The method
getRuleEmptyAtt gets the rules first attribute
without a value in the context list. |
java.lang.String |
getRuleWithGoal()
The method
getRuleWithGoal gets the next rule with
the top of stack goal in the then part. |
boolean |
isRuleComplete(java.lang.String rule_uid)
The method
isRuleComplete evaluates the conditions of the rule. |
boolean |
isTopAttributeSingleValue()
The method
isTopAttributeSingleValue evaluates the top attrinbute on the
goal stack, if it is single value. |
void |
putInitialAttributesOnGoal(java.lang.String curr_expsys_id)
The method
putInitialAttributesOnGoal puts the initial attributes
on the goal stack. |
void |
reset()
The method
reset resets the expert system. |
boolean |
ruleHasElse(java.util.ArrayList conds)
The method
ruleHasElse evaluates the conditions of the rule, if ELSE is available. |
java.util.ArrayList |
ruleInterpreter()
The method
ruleInterpreter performs the knowledge based conclusion. |
getContextList, getContextListAllValues, getContextListFirstRule, getContextListFirstValue, getContextListValue, isValueInSet, putContextList, putListContextList
public static final int ATTRIBUTE
public static final int ATTRIBUTE_ANSWER
public static final int END
public Tool4ExpertSystemDeterministic(n4e.core.list.List4SysUser sysUser, java.lang.String database, boolean debug)
Tool4ExpertSystem
creates a new instance(object) of the class.sysUser
- the system user object.database
- the name of the database.debug
- true: debug onpublic void reset()
reset
resets the expert system.reset
in class Tool4ExpertSystem
public n4e.core.system.Stack getGoalStack()
getGoalStack
gets the goal stack.public java.lang.String getCurrRule()
getCurrRule
gets the current rule.public java.util.ArrayList ruleInterpreter() throws java.lang.Exception
ruleInterpreter
performs the knowledge based conclusion.java.lang.Exception
- if errorpublic void putInitialAttributesOnGoal(java.lang.String curr_expsys_id) throws java.lang.Exception
putInitialAttributesOnGoal
puts the initial attributes
on the goal stack.curr_expsys_id
- the uniqueid of the current expert system.java.lang.Exception
- if errorpublic java.lang.String getRuleWithGoal() throws java.lang.Exception
getRuleWithGoal
gets the next rule with
the top of stack goal in the then part.java.lang.Exception
- if errorpublic boolean ruleHasElse(java.util.ArrayList conds) throws java.lang.Exception
ruleHasElse
evaluates the conditions of the rule, if ELSE is available.conds
- the condition list.java.lang.Exception
- if errorpublic boolean isRuleComplete(java.lang.String rule_uid) throws java.lang.Exception
isRuleComplete
evaluates the conditions of the rule.rule_uid
- the uniqueid of the rule.java.lang.Exception
- if errorpublic boolean isTopAttributeSingleValue() throws java.lang.Exception
isTopAttributeSingleValue
evaluates the top attrinbute on the
goal stack, if it is single value.java.lang.Exception
- if errorpublic java.lang.String getRuleEmptyAtt(java.lang.String rule_uid) throws java.lang.Exception
getRuleEmptyAtt
gets the rules first attribute
without a value in the context list.rule_uid
- the uniqueid of the rule.java.lang.Exception
- if errorpublic boolean evaluateBoolean(java.lang.String att_uid, java.lang.String operator, java.lang.String soperand) throws java.lang.Exception
evaluateBoolean
evaluates a boolean condition.att_uid
- the uniqueid of the attribute.operator
- the operator.soperand
- the operand as string.java.lang.Exception
- if errorpublic boolean evaluateFloat(java.lang.String att_uid, java.lang.String operator, java.lang.String soperand) throws java.lang.Exception
evaluateFloat
evaluates a float condition.att_uid
- the uniqueid of the attribute.operator
- the operator.soperand
- the operand as string.java.lang.Exception
- if errorpublic boolean evaluateInteger(java.lang.String att_uid, java.lang.String operator, java.lang.String soperand) throws java.lang.Exception
evaluateInteger
evaluates an integer condition.att_uid
- the uniqueid of the attribute.operator
- the operator.soperand
- the operand as string.java.lang.Exception
- if errorpublic boolean evaluateSet(java.lang.String att_uid, java.lang.String operator, java.lang.String soperand) throws java.lang.Exception
evaluateSet
evaluates a set condition.att_uid
- the uniqueid of the attribute.operator
- the operator.soperand
- the operand as string.java.lang.Exception
- if errorpublic boolean evaluateString(java.lang.String att_uid, java.lang.String operator, java.lang.String soperand) throws java.lang.Exception
evaluateString
evaluates a string condition.att_uid
- the uniqueid of the attribute.operator
- the operator.soperand
- the operand as string.java.lang.Exception
- if errorpublic boolean evaluateCondition(java.lang.String cond_uid) throws java.lang.Exception
evaluateCondition
evaluates a condition.cond_uid
- the uniqueid of the condition.java.lang.Exception
- if errorpublic void evaluateRule(java.lang.String rule_uid) throws java.lang.Exception
evaluateRule
evaluates the rule.rule_uid
- the uniqueid of the rule.java.lang.Exception
- if error