diff options
Diffstat (limited to 'fuzzylite/fl/imex')
-rw-r--r-- | fuzzylite/fl/imex/CppExporter.h | 70 | ||||
-rw-r--r-- | fuzzylite/fl/imex/Exporter.h | 52 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FclExporter.h | 70 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FclImporter.h | 74 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FisExporter.h | 74 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FisImporter.h | 79 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FldExporter.h | 84 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FllExporter.h | 83 | ||||
-rw-r--r-- | fuzzylite/fl/imex/FllImporter.h | 77 | ||||
-rw-r--r-- | fuzzylite/fl/imex/Importer.h | 52 | ||||
-rw-r--r-- | fuzzylite/fl/imex/JavaExporter.h | 68 |
11 files changed, 783 insertions, 0 deletions
diff --git a/fuzzylite/fl/imex/CppExporter.h b/fuzzylite/fl/imex/CppExporter.h new file mode 100644 index 0000000..e53cf15 --- /dev/null +++ b/fuzzylite/fl/imex/CppExporter.h @@ -0,0 +1,70 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_CPPEXPORTER_H +#define FL_CPPEXPORTER_H + +#include "fl/imex/Exporter.h" + +namespace fl { + class Engine; + class InputVariable; + class OutputVariable; + class Term; + class RuleBlock; + class Norm; + class Defuzzifier; + class Hedge; + + class FL_API CppExporter : public Exporter { + protected: + bool _prefixNamespace; + virtual std::string fl(const std::string& clazz) const; + public: + explicit CppExporter(bool prefixNamespace = false); + virtual ~CppExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(CppExporter) + + virtual std::string name() const FL_IOVERRIDE; + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + + virtual void setPrefixNamespace(bool prefixNamespace); + virtual bool isPrefixNamespace() const; + + virtual std::string toString(const InputVariable* inputVariable, const Engine* engine) const; + virtual std::string toString(const OutputVariable* outputVariable, const Engine* engine) const; + virtual std::string toString(const RuleBlock* ruleBlock, const Engine* engine) const; + virtual std::string toString(scalar value) const; + + virtual std::string toString(const Hedge* hedge) const; + virtual std::string toString(const Term* term) const; + virtual std::string toString(const Norm* op) const; + virtual std::string toString(const Defuzzifier* defuzzifier) const; + + virtual CppExporter* clone() const FL_IOVERRIDE; + + }; +} +#endif /* FL_CPPEXPORTER_H */ + diff --git a/fuzzylite/fl/imex/Exporter.h b/fuzzylite/fl/imex/Exporter.h new file mode 100644 index 0000000..8b55c21 --- /dev/null +++ b/fuzzylite/fl/imex/Exporter.h @@ -0,0 +1,52 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_EXPORTER_H +#define FL_EXPORTER_H + +#include "fl/fuzzylite.h" + +#include <string> + +namespace fl { + class Engine; + + class FL_API Exporter { + public: + + Exporter(); + virtual ~Exporter(); + FL_DEFAULT_COPY_AND_MOVE(Exporter) + + virtual std::string toString(const Engine* engine) const = 0; + virtual void toFile(const std::string& path, const Engine* engine) const; + + virtual std::string name() const = 0; + virtual Exporter* clone() const = 0; + }; + +} + +#endif /* FL_EXPORTER_H */ + diff --git a/fuzzylite/fl/imex/FclExporter.h b/fuzzylite/fl/imex/FclExporter.h new file mode 100644 index 0000000..9bfa3ed --- /dev/null +++ b/fuzzylite/fl/imex/FclExporter.h @@ -0,0 +1,70 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FCLEXPORTER_H +#define FL_FCLEXPORTER_H + +#include "fl/imex/Exporter.h" + +namespace fl { + class InputVariable; + class OutputVariable; + class RuleBlock; + class Norm; + class TNorm; + class SNorm; + class Defuzzifier; + class Term; + + class FL_API FclExporter : public Exporter { + protected: + std::string _indent; + + public: + explicit FclExporter(const std::string& indent = " "); + virtual ~FclExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FclExporter) + + virtual void setIndent(const std::string& indent); + virtual std::string getIndent() const; + + virtual std::string name() const FL_IOVERRIDE; + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + + virtual std::string toString(const InputVariable* variable) const; + virtual std::string toString(const OutputVariable* variable) const; + virtual std::string toString(const RuleBlock* ruleBlock) const; + + virtual std::string toString(const Norm* norm) const; + + virtual std::string toString(const TNorm* tnorm) const; //TODO: Delete in v6.0 + virtual std::string toString(const SNorm* snorm) const; //TODO: Delete in v6.0 + virtual std::string toString(const Defuzzifier* defuzzifier) const; + virtual std::string toString(const Term* term) const; + + virtual FclExporter* clone() const FL_IOVERRIDE; + }; + +} +#endif /* FL_FCLEXPORTER_H */ diff --git a/fuzzylite/fl/imex/FclImporter.h b/fuzzylite/fl/imex/FclImporter.h new file mode 100644 index 0000000..b219717 --- /dev/null +++ b/fuzzylite/fl/imex/FclImporter.h @@ -0,0 +1,74 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FCLIMPORTER_H +#define FL_FCLIMPORTER_H + +#include "fl/imex/Importer.h" + +#include <string> +#include <utility> +#include <vector> + + +namespace fl { + class Norm; + class TNorm; + class SNorm; + class Term; + class Defuzzifier; + + class FL_API FclImporter : public Importer { + public: + FclImporter(); + virtual ~FclImporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FclImporter) + + virtual std::string name() const FL_IOVERRIDE; + + virtual Engine* fromString(const std::string& fcl) const FL_IOVERRIDE; + + virtual FclImporter* clone() const FL_IOVERRIDE; + + protected: + virtual void processBlock(const std::string& tag, const std::string& block, Engine* engine) const; + virtual void processVar(const std::string& var, const std::string& block, Engine* engine)const; + virtual void processFuzzify(const std::string& block, Engine* engine)const; + virtual void processDefuzzify(const std::string& block, Engine* engine)const; + virtual void processRuleBlock(const std::string& block, Engine* engine)const; + + virtual TNorm* parseTNorm(const std::string& line) const; + virtual SNorm* parseSNorm(const std::string& line) const; + virtual Term* parseTerm(const std::string& line, const Engine* engine) const; + + virtual Defuzzifier* parseDefuzzifier(const std::string& line) const; + virtual std::pair<scalar, bool> parseDefaultValue(const std::string& line) const; + virtual std::pair<scalar, scalar> parseRange(const std::string& line) const; + virtual std::pair<bool, bool> parseLocks(const std::string& line) const; + virtual bool parseEnabled(const std::string& line) const; + + }; + +} +#endif /* FL_FCLIMPORTER_H */ diff --git a/fuzzylite/fl/imex/FisExporter.h b/fuzzylite/fl/imex/FisExporter.h new file mode 100644 index 0000000..05d6a22 --- /dev/null +++ b/fuzzylite/fl/imex/FisExporter.h @@ -0,0 +1,74 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FISEXPORTER_H +#define FL_FISEXPORTER_H + +#include "fl/imex/Exporter.h" + +#include <vector> + +namespace fl { + class Norm; + class TNorm; + class SNorm; + class Defuzzifier; + class Term; + class Rule; + class Proposition; + class Variable; + + class FL_API FisExporter : public Exporter { + protected: + + virtual std::string translate(const std::vector<Proposition*>& propositions, + const std::vector<Variable*> variables) const; + + public: + FisExporter(); + virtual ~FisExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FisExporter) + + virtual std::string name() const FL_IOVERRIDE; + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + + virtual std::string toString(const Norm* norm) const; + virtual std::string toString(const TNorm* tnorm) const; //TODO: delete in v6.0 + virtual std::string toString(const SNorm* snorm) const; //TODO: delete in v6.0 + virtual std::string toString(const Defuzzifier* defuzzifier) const; + virtual std::string toString(const Term* term) const; + + virtual std::string exportSystem(const Engine* engine) const; + virtual std::string exportInputs(const Engine* engine) const; + virtual std::string exportOutputs(const Engine* engine) const; + virtual std::string exportRules(const Engine* engine) const; + virtual std::string exportRule(const Rule* rule, const Engine* engine) const; + + virtual FisExporter* clone() const FL_IOVERRIDE; + }; + +} + +#endif /* FL_FISEXPORTER_H */ + diff --git a/fuzzylite/fl/imex/FisImporter.h b/fuzzylite/fl/imex/FisImporter.h new file mode 100644 index 0000000..b631a48 --- /dev/null +++ b/fuzzylite/fl/imex/FisImporter.h @@ -0,0 +1,79 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FISIMPORTER_H +#define FL_FISIMPORTER_H + +#include "fl/imex/Importer.h" + +#include <utility> +#include <vector> + + +namespace fl { + class Norm; + class TNorm; + class SNorm; + class Term; + class Defuzzifier; + class Variable; + + class FL_API FisImporter : public Importer { + public: + FisImporter(); + virtual ~FisImporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FisImporter) + + virtual std::string name() const FL_IOVERRIDE; + + virtual Engine* fromString(const std::string& fcl) const FL_IOVERRIDE; + + virtual FisImporter* clone() const FL_IOVERRIDE; + + protected: + virtual void importSystem(const std::string& section, Engine* engine, + std::string& andMethod, std::string& orMethod, + std::string& impMethod, std::string& aggMethod, + std::string& defuzzMethod) const; + virtual void importInput(const std::string& section, Engine* engine) const; + virtual void importOutput(const std::string& section, Engine* engine) const; + virtual void importRules(const std::string& section, Engine* engine) const; + virtual std::string translateProposition(scalar code, Variable* variable) const; + + //TODO: rename extract to translate in v6.0 + virtual std::string extractTNorm(const std::string& tnorm) const; + virtual std::string extractSNorm(const std::string& tnorm) const; + virtual std::string extractDefuzzifier(const std::string& defuzzifier) const; + + virtual Term* parseTerm(const std::string& line, const Engine* engine) const; + virtual Term* createInstance(const std::string& termClass, const std::string& name, + const std::vector<std::string>& params, const Engine* engine) const; + //TODO: rename to parseRange in v6.0 + virtual std::pair<scalar, scalar> range(const std::string& range) const; + + }; + +} +#endif /* FL_FISIMPORTER_H */ + diff --git a/fuzzylite/fl/imex/FldExporter.h b/fuzzylite/fl/imex/FldExporter.h new file mode 100644 index 0000000..71679a6 --- /dev/null +++ b/fuzzylite/fl/imex/FldExporter.h @@ -0,0 +1,84 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FLDEXPORTER_H +#define FL_FLDEXPORTER_H + +#include "fl/imex/Exporter.h" + +#include <vector> + +namespace fl { + class Engine; + class InputVariable; + class OutputVariable; + + class FL_API FldExporter : public Exporter { + protected: + std::string _separator; + bool _exportHeaders; + bool _exportInputValues; + bool _exportOutputValues; + public: + explicit FldExporter(const std::string& separator = " "); + virtual ~FldExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FldExporter) + + virtual std::string name() const FL_IOVERRIDE; + + virtual void setSeparator(const std::string& separator); + virtual std::string getSeparator() const; + + virtual void setExportHeader(bool exportHeaders); + virtual bool exportsHeader() const; + + virtual void setExportInputValues(bool exportInputValues); + virtual bool exportsInputValues() const; + + virtual void setExportOutputValues(bool exportOutputValues); + virtual bool exportsOutputValues() const; + + virtual std::string header(const Engine* engine) const; + + //WARNING: The engine will be const_casted in order to be processed! + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + virtual std::string toString(Engine* engine, int maximumNumberOfResults) const; + virtual std::string toString(Engine* engine, const std::string& inputData) const; + + using Exporter::toFile; + virtual void toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const; + virtual void toFile(const std::string& path, Engine* engine, const std::string& inputData) const; + + virtual std::vector<scalar> parse(const std::string& x) const; + + void write(Engine* engine, std::ostream& writer, int maximumNumberOfResults) const; + void write(Engine* engine, std::ostream& writer, std::istream& reader) const; + void write(Engine* engine, std::ostream& writer, const std::vector<scalar>& inputValues) const; + + virtual FldExporter* clone() const FL_IOVERRIDE; + }; +} + +#endif /* FL_FLDEXPORTER_H */ + diff --git a/fuzzylite/fl/imex/FllExporter.h b/fuzzylite/fl/imex/FllExporter.h new file mode 100644 index 0000000..e6a89f5 --- /dev/null +++ b/fuzzylite/fl/imex/FllExporter.h @@ -0,0 +1,83 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FLLEXPORTER_H +#define FL_FLLEXPORTER_H + +#include "fl/imex/Exporter.h" + +#include <vector> + +namespace fl { + class Variable; + class InputVariable; + class OutputVariable; + class RuleBlock; + class Rule; + class Norm; + class Defuzzifier; + class Term; + + class FL_API FllExporter : public Exporter { + protected: + std::string _indent; + std::string _separator; + public: + explicit FllExporter(const std::string& indent = " ", const std::string& separator = "\n"); + virtual ~FllExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FllExporter) + + virtual std::string name() const FL_IOVERRIDE; + + virtual void setIndent(const std::string& indent); + virtual std::string getIndent() const; + + virtual void setSeparator(const std::string& separator); + virtual std::string getSeparator() const; + + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + + virtual std::string toString(const std::vector<Variable*>& variables) const; + virtual std::string toString(const std::vector<InputVariable*>& inputVariables) const; + virtual std::string toString(const std::vector<OutputVariable*>& outputVariables) const; + virtual std::string toString(const std::vector<RuleBlock*>& ruleBlocks) const; + + virtual std::string toString(const Variable* variable) const; + virtual std::string toString(const InputVariable* inputVariable) const; + virtual std::string toString(const OutputVariable* outputVariable) const; + + virtual std::string toString(const RuleBlock* ruleBlock) const; + virtual std::string toString(const Rule* rule) const; + + virtual std::string toString(const Norm* norm) const; + virtual std::string toString(const Defuzzifier* defuzzifier) const; + virtual std::string toString(const Term* term) const; + + virtual FllExporter* clone() const FL_IOVERRIDE; + }; + +} + +#endif /* FL_FLLEXPORTER_H */ + diff --git a/fuzzylite/fl/imex/FllImporter.h b/fuzzylite/fl/imex/FllImporter.h new file mode 100644 index 0000000..5be41c7 --- /dev/null +++ b/fuzzylite/fl/imex/FllImporter.h @@ -0,0 +1,77 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_FLLIMPORTER_H +#define FL_FLLIMPORTER_H + +#include "fl/imex/Importer.h" + +#include <utility> + +namespace fl { + class TNorm; + class SNorm; + class Term; + class Defuzzifier; + + class FL_API FllImporter : public Importer { + protected: + std::string _separator; + public: + explicit FllImporter(const std::string& separator = "\n"); + virtual ~FllImporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(FllImporter) + + virtual void setSeparator(const std::string& separator); + virtual std::string getSeparator() const; + + virtual std::string name() const FL_IOVERRIDE; + virtual Engine* fromString(const std::string& fll) const FL_IOVERRIDE; + + virtual FllImporter* clone() const FL_IOVERRIDE; + + protected: + virtual void process(const std::string& tag, const std::string& block, Engine* engine) const; + virtual void processInputVariable(const std::string& block, Engine* engine) const; + virtual void processOutputVariable(const std::string& block, Engine* engine) const; + virtual void processRuleBlock(const std::string& block, Engine* engine) const; + + virtual TNorm* parseTNorm(const std::string& name) const; + virtual SNorm* parseSNorm(const std::string& name) const; + + virtual Term* parseTerm(const std::string& text, Engine* engine) const; + + virtual Defuzzifier* parseDefuzzifier(const std::string& line) const; + virtual std::pair<scalar, scalar> parseRange(const std::string& line) const; + virtual bool parseBoolean(const std::string& boolean) const; + + virtual std::pair<std::string, std::string> parseKeyValue(const std::string& text, + char separator = ':') const; + virtual std::string clean(const std::string& line) const; + + }; +} + +#endif /* FL_FLLIMPORTER_H */ + diff --git a/fuzzylite/fl/imex/Importer.h b/fuzzylite/fl/imex/Importer.h new file mode 100644 index 0000000..28d2b36 --- /dev/null +++ b/fuzzylite/fl/imex/Importer.h @@ -0,0 +1,52 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_IMPORTER_H +#define FL_IMPORTER_H + +#include "fl/fuzzylite.h" + +#include <string> + +namespace fl { + class Engine; + + class FL_API Importer { + public: + + Importer(); + virtual ~Importer(); + FL_DEFAULT_COPY_AND_MOVE(Importer) + + virtual Engine* fromString(const std::string& s) const = 0; + virtual Engine* fromFile(const std::string& path) const; + + virtual std::string name() const = 0; + virtual Importer* clone() const = 0; + }; + +} + +#endif /* IMPORTER_H */ + diff --git a/fuzzylite/fl/imex/JavaExporter.h b/fuzzylite/fl/imex/JavaExporter.h new file mode 100644 index 0000000..e882d4a --- /dev/null +++ b/fuzzylite/fl/imex/JavaExporter.h @@ -0,0 +1,68 @@ +/* + Author: Juan Rada-Vilela, Ph.D. + Copyright (C) 2010-2014 FuzzyLite Limited + All rights reserved + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + fuzzylite is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + for more details. + + You should have received a copy of the GNU Lesser General Public License + along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. + + fuzzylite™ is a trademark of FuzzyLite Limited. + + */ + +#ifndef FL_JAVAEXPORTER_H +#define FL_JAVAEXPORTER_H + +#include "fl/imex/Exporter.h" + +namespace fl { + + class Engine; + class InputVariable; + class OutputVariable; + class RuleBlock; + class Term; + class Defuzzifier; + class Norm; + class SNorm; + class TNorm; + + class FL_API JavaExporter : public Exporter { + public: + JavaExporter(); + virtual ~JavaExporter() FL_IOVERRIDE; + FL_DEFAULT_COPY_AND_MOVE(JavaExporter) + + virtual std::string name() const FL_IOVERRIDE; + + virtual std::string toString(const Engine* engine) const FL_IOVERRIDE; + virtual std::string toString(const InputVariable* inputVariable, const Engine* engine) const; + virtual std::string toString(const OutputVariable* outputVariable, const Engine* engine) const; + virtual std::string toString(const RuleBlock* ruleBlock, const Engine* engine) const; + virtual std::string toString(const Term* term) const; + virtual std::string toString(const Defuzzifier* defuzzifier) const; + virtual std::string toString(const Norm* norm) const; + virtual std::string toString(const SNorm* norm) const;//TODO: delete in v6.0 + virtual std::string toString(const TNorm* norm) const;//TODO: delete in v6.0 + virtual std::string toString(scalar value) const; + + virtual JavaExporter* clone() const FL_IOVERRIDE; + + }; + +} + +#endif /* FL_JAVAEXPORTER_H */ + |