Class ScriptedProblem

java.lang.Object
org.moeaframework.problem.ProblemWrapper
org.moeaframework.problem.ScriptedProblem
All Implemented Interfaces:
AutoCloseable, Problem

public class ScriptedProblem extends ProblemWrapper
Permits interfacing with problems implemented by one of the many scripting languages supported by the Java Scripting APIs.

Currently, only scripting engines which support the Invocable interface are supported. The script itself should contain methods equivalent to the methods in Problem, with the same names, arguments and return values.

  • Constructor Details

    • ScriptedProblem

      public ScriptedProblem(String script, String name) throws ScriptException
      Constructs a new problem implemented in a scripting language.
      Parameters:
      script - the script
      name - the name of the scripting engine
      Throws:
      ScriptException - if an error occurred in the Scripting APIs
    • ScriptedProblem

      public ScriptedProblem(Reader reader, String name) throws ScriptException
      Constructs a new problem implemented in a scripting language.
      Parameters:
      reader - the reader for loading the script contents
      name - the name of the scripting engine
      Throws:
      ScriptException - if an error occurred in the Scripting APIs
    • ScriptedProblem

      public ScriptedProblem(File file) throws ScriptException, IOException
      Constructs a new problem implemented in a scripting language.
      Parameters:
      file - the file containing the script contents, and whose file extension identifies the scripting language
      Throws:
      ScriptException - if an error occurred in the Scripting APIs
      IOException - if an I/O error occurred