This commit is contained in:
marcin-szczepanski 2022-07-27 13:51:24 +02:00
parent 3bfa35fa40
commit c5f53a2a50
3 changed files with 25 additions and 9 deletions

View File

@ -1,7 +1,5 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Code generated by jFuzzyLogic // Code generated by jFuzzyLogic
// jFuzzyLogic Version : JFuzzyLogic 4.0 (build 2022-05-12), by Pablo Cingolani
// jFuzzyLogic created by Pablo Cingolani
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
function ruleAccumulationMethod_max(defuzzifierValue, valueToAggregate) { function ruleAccumulationMethod_max(defuzzifierValue, valueToAggregate) {
@ -205,4 +203,6 @@ function main(food, service) {
// Show results // Show results
tipper.print(); tipper.print();
return [tipper.tip];
} }

View File

@ -3,11 +3,7 @@ package net.sourceforge.jFuzzyLogic;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import net.sourceforge.jFuzzyLogic.fcl.FclLexer; import net.sourceforge.jFuzzyLogic.fcl.FclLexer;
import net.sourceforge.jFuzzyLogic.fcl.FclObject; import net.sourceforge.jFuzzyLogic.fcl.FclObject;
@ -347,8 +343,6 @@ public class FIS extends FclObject implements Iterable<FunctionBlock>, CompileCp
out.append("//--------------------------------------------------------------------------------\n"); out.append("//--------------------------------------------------------------------------------\n");
out.append("// Code generated by jFuzzyLogic\n"); out.append("// Code generated by jFuzzyLogic\n");
out.append("// jFuzzyLogic Version : " + JFuzzyLogic.VERSION + " \n");
out.append("// jFuzzyLogic created by Pablo Cingolani\n");
out.append("//--------------------------------------------------------------------------------\n\n"); out.append("//--------------------------------------------------------------------------------\n\n");
// Sort function blocks by name // Sort function blocks by name
@ -443,6 +437,28 @@ public class FIS extends FclObject implements Iterable<FunctionBlock>, CompileCp
out.append("\t// Show results\n"); out.append("\t// Show results\n");
for (String name : fbNames) for (String name : fbNames)
out.append("\t" + name + ".print();\n"); out.append("\t" + name + ".print();\n");
out.append("\n\treturn [");
for (String name : fbNames) {
FunctionBlock functionBlock = getFunctionBlock(name);
int k = 0;
List<Variable> outs = new ArrayList<>();
for (Variable var : functionBlock.variablesSorted()) {
if (var.isOutput()) {
outs.add(var);
}
}
for (Variable var : outs) {
if (var.isOutput()) {
out.append(name + "." + var.getName());
if (k < outs.size() - 1) {
out.append(", ");
}
k++;
}
}
}
out.append("];\n");
out.append("}"); out.append("}");
return out.toString(); return out.toString();