home Forums # Technical Support SimpleDimmer.java : how to get one specific power value back from engine? Reply To: SimpleDimmer.java : how to get one specific power value back from engine?

#2207

Hi,

thank you for your post.

you can automatically generate the Java or C++ code of any engine with: new JavaExporter().toString(engine);. Thus, you can export the engine to Java and use the exported Java code in your application instead.

For example:

Engine engine = null;
String configurationFile = "C:\\IBM\\workspaceFuzzyLite\\1.fll";
try         {
    engine = new FllImporter().fromFile(new File(configurationFile));
} catch (Exception ex)         {
  FuzzyLite.logger().log(Level.SEVERE, ex.toString(), ex);
}
System.out.println(new JavaExporter().toString(engine)); //this will print the engine in Java code

Once you copy and paste your java-coded engine in your application, you can do:

inputVariable.setInputValue(0.310);
engine.process()
System.out.println("Answer is " + outputVariable.getOutputValue());

Please, refer to http://www.fuzzylite.com/java to see how an engine in Java looks like.

Cheers.