Skip to content

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
- Import/export Matlab and FCL
- TAO example
- Bug fixed

Signed-off-by: sotillo19 <[email protected]>
  • Loading branch information
sotillo19 committed Dec 15, 2017
1 parent 1a836a9 commit e2a5ac6
Show file tree
Hide file tree
Showing 30 changed files with 207 additions and 133 deletions.
7 changes: 5 additions & 2 deletions Examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JDK=
JFMLpath=.
JFML=$(JFMLpath)/lib/JFML-v1.1.jar
JFML=$(JFMLpath)/lib/JFML-v1.2.jar
JFMLxmlfiles=$(JFMLpath)/XMLFiles/

default:
Expand Down Expand Up @@ -169,4 +169,7 @@ testTipperMamdani1Import:
java -jar $(JFML) $(JFMLxmlfiles)TipperMamdani1.xml $(JFMLxmlfiles)test-data-Tipper1.txt

testTipperTSKImport:
java -jar $(JFML) $(JFMLxmlfiles)TipperTSK.xml $(JFMLxmlfiles)test-data-Tipper1.txt
java -jar $(JFML) $(JFMLxmlfiles)TipperTSK.xml $(JFMLxmlfiles)test-data-Tipper1.txt

testTao:
java -jar $(JFML) $(JFMLxmlfiles)taoFML.xml 1 Class x1 90 x2 60 Sumx1x2 150
114 changes: 60 additions & 54 deletions Examples/README-EXAMPLES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,68 +22,74 @@ You can also run the library with a specific instance, for your own XML file, as
Before running the examples, please be sure the XMLFiles folder contains the required XML files.
Otherwise, you can create some of them from the command line:
Examples:
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateIrisMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateIrisMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateIrisMamdaniExampleXML3
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateInvertedPendulumMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateInvertedPendulumMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateInvertedPendulumTSKExampleXML1
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateInvertedPendulumTSKExampleXML2
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateJapaneseDietAssessmentMamdaniExampleXML
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperMamdaniExampleXML3
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperTSKExampleXML
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperTsukamotoExampleXML1
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperTsukamotoExampleXML2
> java -classpath ./lib/JFML-v1.1.jar jfml.test.CreateTipperAnYaExampleXML
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateIrisMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateIrisMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateIrisMamdaniExampleXML3
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateInvertedPendulumMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateInvertedPendulumMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateInvertedPendulumTSKExampleXML1
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateInvertedPendulumTSKExampleXML2
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateJapaneseDietAssessmentMamdaniExampleXML
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperMamdaniExampleXML1
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperMamdaniExampleXML2
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperMamdaniExampleXML3
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperTSKExampleXML
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperTsukamotoExampleXML1
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperTsukamotoExampleXML2
> java -classpath ./lib/JFML-v1.2.jar jfml.test.CreateTipperAnYaExampleXML

Tests:
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani1 ./XMLFiles/test-data-Iris1.txt
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani1 PetalWidth 0.2
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani2 ./XMLFiles/test-data-Iris2.txt
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani2 SepalLength 5.1 SepalWidth 3.5 PetalLength 1.4 PetalWidth 0.2
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani3 ./XMLFiles/test-data-Iris1.txt
> java -jar ./lib/JFML-v1.1.jar Iris Mamdani3 PetalWidth 0.5
> java -jar ./lib/JFML-v1.1.jar InvertedPendulum Mamdani1 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.1.jar InvertedPendulum Mamdani2 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.1.jar InvertedPendulum TSK1 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.1.jar InvertedPendulum TSK2 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.1.jar JapaneseDietAssessment Mamdani ./XMLFiles/test-data-JapaneseDietAssessment.txt
> java -jar ./lib/JFML-v1.1.jar Tipper Mamdani1 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.1.jar Tipper Mamdani2 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.1.jar Tipper Mamdani3 ./XMLFiles/test-data-Tipper2.txt
> java -jar ./lib/JFML-v1.1.jar Tipper TSK ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.1.jar Tipper Tsukamoto1 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.1.jar Tipper Tsukamoto2 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.1.jar Tipper AnYa ./XMLFiles/test-data-Tipper2.txt
> java -jar ./lib/JFML-v1.1.jar Robot Mamdani ./XMLFiles/test-data-Robot.txt
> java -jar ./lib/JFML-v1.1.jar ./XMLFiles/RobotIEEEstd1855.xml ./XMLFiles/test-data-Robot.txt
> java -jar ./lib/JFML-v1.1.jar ./XMLFiles/RobotIEEEstd1855.xml 2 la av rd 0.2 dq 0.25 o 20 v 0.25
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani1 ./XMLFiles/test-data-Iris1.txt
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani1 PetalWidth 0.2
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani2 ./XMLFiles/test-data-Iris2.txt
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani2 SepalLength 5.1 SepalWidth 3.5 PetalLength 1.4 PetalWidth 0.2
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani3 ./XMLFiles/test-data-Iris1.txt
> java -jar ./lib/JFML-v1.2.jar Iris Mamdani3 PetalWidth 0.5
> java -jar ./lib/JFML-v1.2.jar InvertedPendulum Mamdani1 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.2.jar InvertedPendulum Mamdani2 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.2.jar InvertedPendulum TSK1 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.2.jar InvertedPendulum TSK2 ./XMLFiles/test-data-InvertedPendulum.txt
> java -jar ./lib/JFML-v1.2.jar JapaneseDietAssessment Mamdani ./XMLFiles/test-data-JapaneseDietAssessment.txt
> java -jar ./lib/JFML-v1.2.jar Tipper Mamdani1 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.2.jar Tipper Mamdani2 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.2.jar Tipper Mamdani3 ./XMLFiles/test-data-Tipper2.txt
> java -jar ./lib/JFML-v1.2.jar Tipper TSK ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.2.jar Tipper Tsukamoto1 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.2.jar Tipper Tsukamoto2 ./XMLFiles/test-data-Tipper1.txt
> java -jar ./lib/JFML-v1.2.jar Tipper AnYa ./XMLFiles/test-data-Tipper2.txt
> java -jar ./lib/JFML-v1.2.jar Robot Mamdani ./XMLFiles/test-data-Robot.txt
> java -jar ./lib/JFML-v1.2.jar ./XMLFiles/RobotIEEEstd1855.xml ./XMLFiles/test-data-Robot.txt
> java -jar ./lib/JFML-v1.2.jar ./XMLFiles/RobotIEEEstd1855.xml 2 la av rd 0.2 dq 0.25 o 20 v 0.25

Export:

> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani1.xml ./XMLFiles/IrisMamdani1.fis
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani1.xml ./XMLFiles/IrisMamdani1.fcl
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani2.xml ./XMLFiles/IrisMamdani2.fis
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani1.xml ./XMLFiles/TipperMamdani1.fis
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani1.xml ./XMLFiles/TipperMamdani1.fcl
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani2.xml ./XMLFiles/TipperMamdani2.fis
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani2.xml ./XMLFiles/TipperMamdani2.fcl
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperTSK.xml ./XMLFiles/TipperTSK.fis
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ExportExample ./XMLFiles/TipperTSK.xml ./XMLFiles/TipperTSK.fcl
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani1.xml ./XMLFiles/IrisMamdani1.fis
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani1.xml ./XMLFiles/IrisMamdani1.fcl
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/IrisMamdani2.xml ./XMLFiles/IrisMamdani2.fis
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani1.xml ./XMLFiles/TipperMamdani1.fis
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani1.xml ./XMLFiles/TipperMamdani1.fcl
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani2.xml ./XMLFiles/TipperMamdani2.fis
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperMamdani2.xml ./XMLFiles/TipperMamdani2.fcl
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperTSK.xml ./XMLFiles/TipperTSK.fis
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/TipperTSK.xml ./XMLFiles/TipperTSK.fcl

Import:

> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani1.fis ./XMLFiles/IrisMamdani1.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani1.fcl ./XMLFiles/IrisMamdani1.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani2.fis ./XMLFiles/IrisMamdani2.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani1.fis ./XMLFiles/TipperMamdani1.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani1.fcl ./XMLFiles/TipperMamdani1.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani2.fis ./XMLFiles/TipperMamdani2.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani2.fcl ./XMLFiles/TipperMamdani2.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperTSK.fis ./XMLFiles/TipperTSK.xml
> java -classpath ./lib/JFML-v1.1.jar jfml.test.ImportExample ./XMLFiles/TipperTSK.fcl ./XMLFiles/TipperTSK.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani1.fis ./XMLFiles/IrisMamdani1.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani1.fcl ./XMLFiles/IrisMamdani1.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/IrisMamdani2.fis ./XMLFiles/IrisMamdani2.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani1.fis ./XMLFiles/TipperMamdani1.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani1.fcl ./XMLFiles/TipperMamdani1.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani2.fis ./XMLFiles/TipperMamdani2.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperMamdani2.fcl ./XMLFiles/TipperMamdani2.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperTSK.fis ./XMLFiles/TipperTSK.xml
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ImportExample ./XMLFiles/TipperTSK.fcl ./XMLFiles/TipperTSK.xml

Circular Definitions:

> java -classpath ./lib/JFML-v1.2.jar jfml.test.TaoExample
> java -jar ./lib/JFML-v1.2.jar ./XMLFiles/taoFML.xml 1 Class x1 90 x2 60 Sumx1x2 150
> java -classpath ./lib/JFML-v1.2.jar jfml.test.ExportExample ./XMLFiles/taoFML.xml ./XMLFiles/taoFML.fis


In addition, notice that you can run the examples above by calling to the related bat files in Windows OS or by running the Makefile otherwise.
4 changes: 2 additions & 2 deletions Examples/XMLFiles/taoFML.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</then>
</consequent>
</rule>
<rule name="R1" andMethod="min" orMethod="MAX" connector="and" weight="0.884">
<rule name="r2" andMethod="min" orMethod="MAX" connector="and" weight="0.884">
<antecedent>
<clause>
<variable>Sumx1x2</variable>
Expand All @@ -121,7 +121,7 @@
</then>
</consequent>
</rule>
<rule name="R2" andMethod="min" orMethod="MAX" connector="and" weight="0.908">
<rule name="r3" andMethod="min" orMethod="MAX" connector="and" weight="0.908">
<antecedent>
<clause>
<variable>x1</variable>
Expand Down
Binary file added Examples/lib/JFML-v1.2.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateInvertedPendulumMamdaniExampleXML1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateInvertedPendulumMamdaniExampleXML2
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateInvertedPendulumTSKExampleXML1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateInvertedPendulumTSKExampleXML2
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateIrisMamdaniExampleXML1.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateIrisMamdaniExampleXML1
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateIrisMamdaniExampleXML2.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateIrisMamdaniExampleXML2
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateIrisMamdaniExampleXML3.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateIrisMamdaniExampleXML3
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateJapaneseDietAssessmentMamdaniExampleXML
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperAnYaExampleXML.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperAnYaExampleXML
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperMamdaniExampleXML1.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperMamdaniExampleXML1
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperMamdaniExampleXML2.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperMamdaniExampleXML2
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperMamdaniExampleXML3.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperMamdaniExampleXML3
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperTSKExampleXML.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperTSKExampleXML
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperTsukamotoExampleXML1.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperTsukamotoExampleXML1
2 changes: 1 addition & 1 deletion Examples/main-jfml-CreateTipperTsukamotoExampleXML2.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.CreateTipperTsukamotoExampleXML2
2 changes: 1 addition & 1 deletion Examples/main-jfml-export.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.ExportExample %1 %2
2 changes: 1 addition & 1 deletion Examples/main-jfml-import.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.ImportExample %1 %2
2 changes: 1 addition & 1 deletion Examples/main-jfml-test.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set CPATH=.\lib\JFML-v1.1.jar
set CPATH=.\lib\JFML-v1.2.jar
java -classpath %CPATH% jfml.test.EvaluateExample %1 %2 %3
2 changes: 1 addition & 1 deletion buildJAR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<property name="classes" location="bin"/>
<property name="lib" location="Examples/lib"/>
<property name="Name" value="JFML"/>
<property name="version" value="1.1"/>
<property name="version" value="1.2"/>

<target name="init">
<!-- Create the classes directory structure used by compile -->
Expand Down
27 changes: 27 additions & 0 deletions src/jfml/jaxb/FuzzySystemType.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@ public List<Object> getRuleBase() {
ruleBase = new ArrayList<Object>();
}
return this.ruleBase;
}

/**
* Gets the FuzzySystemRuleBase from the list of RuleBase by the parameter index
* @param index the index of the rulebase
* @return A FuzzySystemRuleBase or null if the index does not match
*/
public FuzzySystemRuleBase getRuleBase(int index){
FuzzySystemRuleBase rb = null;
if (ruleBase != null && ruleBase.size()>index){
Object[] RBs= ruleBase.toArray();
rb= (FuzzySystemRuleBase) ((JAXBElement)RBs[index]).getValue();
}
return rb;
}

/**
* Gets an array with all the rule bases
* @return an array with all the rule bases
*/
public ArrayList<FuzzySystemRuleBase> getAllRuleBase(){
ArrayList<FuzzySystemRuleBase> rbs = new ArrayList<>();
if (ruleBase != null){
for(Object rb : ruleBase)
rbs.add((FuzzySystemRuleBase) ((JAXBElement)rb).getValue());
}
return rbs;
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/jfml/rule/AntecedentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ public void addClause(KnowledgeBaseVariable variable, FuzzyTerm term){
ClauseType c = new ClauseType(variable,term);
if(c!=null)
clauses.add(c);
}

/**
* Adds a ClauseType with a {@link KnowledgeBaseVariable } and a {@link FuzzyTerm }
* @param variable the {@link KnowledgeBaseVariable }
* @param term the name of the {@link FuzzyTerm }
*/
public void addClause(KnowledgeBaseVariable variable, String term){
if (clauses == null) {
clauses = new ArrayList<ClauseType>();
}
ClauseType c = new ClauseType(variable,variable.getTerm(term));
if(c!=null)
clauses.add(c);
}

}
7 changes: 4 additions & 3 deletions src/jfml/rule/ConsequentClausesType.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import javax.xml.bind.annotation.XmlType;

import jfml.knowledgebase.variable.KnowledgeBaseVariable;
import jfml.term.FuzzyTerm;
import jfml.term.FuzzyTerm;
import jfml.term.Term;


/**
Expand Down Expand Up @@ -107,9 +108,9 @@ public void addClause(ClauseType c){
/**
* Adds a ClauseType with a {@link KnowledgeBaseVariable } and a {@link FuzzyTerm }
* @param variable the {@link KnowledgeBaseVariable }
* @param term the {@link FuzzyTerm }
* @param term the {@link Term }
*/
public void addClause(KnowledgeBaseVariable v, FuzzyTerm t){
public void addClause(KnowledgeBaseVariable v, Term t){
if (clauses == null) {
clauses = new ArrayList<ClauseType>();
}
Expand Down
24 changes: 24 additions & 0 deletions src/jfml/rule/ConsequentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ public void addThenClause(KnowledgeBaseVariable variable, FuzzyTerm term){
then = new ConsequentClausesType();

then.addClause(variable, term);
}

/**
* Adds a THEN ClauseType with a {@link KnowledgeBaseVariable } and a {@link FuzzyTerm }
* @param variable the {@link KnowledgeBaseVariable }
* @param term the name of the {@link FuzzyTerm }
*/
public void addThenClause(KnowledgeBaseVariable variable, String term){
if(then==null)
then = new ConsequentClausesType();

then.addClause(variable, variable.getTerm(term));
}

/**
Expand All @@ -114,6 +126,18 @@ public void addElseClause(KnowledgeBaseVariable variable, FuzzyTerm term){
_else = new ConsequentClausesType();

_else.addClause(variable, term);
}

/**
* Adds an ELSE ClauseType with a {@link KnowledgeBaseVariable } and a {@link FuzzyTerm }
* @param variable the {@link KnowledgeBaseVariable }
* @param term the name of the {@link FuzzyTerm }
*/
public void addElseClause(KnowledgeBaseVariable variable, String term){
if(_else==null)
_else = new ConsequentClausesType();

_else.addClause(variable, variable.getTerm(term));
}

/**
Expand Down
Loading

0 comments on commit e2a5ac6

Please sign in to comment.