#4 -- Add some functions for consequent
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 59s
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 59s
This commit is contained in:
parent
e91642e1d0
commit
ae309290ff
@ -1,20 +1,35 @@
|
|||||||
|
|
||||||
// Rules parsing
|
// Rules parsing
|
||||||
|
// antecedent
|
||||||
function getAntecedent(rule) {
|
function getAntecedent(rule) {
|
||||||
withoutIf = rule.split('if');
|
var withoutIf = rule.split('if');
|
||||||
return withoutIf[1].trim().split('then')[0].trim();
|
return withoutIf[1].trim().split('then')[0].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: remove duplicate
|
||||||
function getAntecedentComponents(antecedent) {
|
function getAntecedentComponents(antecedent) {
|
||||||
return antecedent.split('and').map((i) => i.trim());
|
return antecedent.split('and').map((i) => i.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVariable(antecedent) {
|
// consequent
|
||||||
return antecedent.split('is')[0].trim();
|
function getConsequent(rule) {
|
||||||
|
var withoutIf = rule.split('if');
|
||||||
|
return withoutIf[1].trim().split('then')[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVariableValue(antecedent) {
|
// TODO: remove duplicate
|
||||||
return antecedent.split('is')[1].trim();
|
function getConsequentComponents(consequent) {
|
||||||
|
return consequent.split('and').map((i) => i.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
// common
|
||||||
|
function getVariable(variableComponents) {
|
||||||
|
return variableComponents.split('is')[0].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVariableValue(variableComponents) {
|
||||||
|
return variableComponents.split('is')[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rules creation
|
// Rules creation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user