Interface EquationCompiler

  • public interface EquationCompiler
    Compiler that compiles equations to byte (non-Java) code.

    Module: equations-api

    To use this in your app, include the following dependency in your POM:


    Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
    • Method Detail

      • compile

        boolean compile​(String equation,
                        Map<String,​Class<?>> variableNameToTypeMap)
        Compiles a string to byte code plus some metadata as encapsulated by the Equation class
        equation - a textual representation of an equation
        variableNameToTypeMap - a mapping from variable names occurring in "equation" to their respective types
        true if the compiler successfully compiles the equation.
      • getLastErrorMsg

        String getLastErrorMsg()
        Returns an error message for an error encountered during a call to compile, if any.
        a human readable error message Please note that it is probably a good idea to only call this method if compile() returned false.
      • getEquation

        Equation getEquation()
        If compile() returns true, this returns the result of the compilation.
        an Equation representing the code compiled from the string passed into compile()
      • getErrorEquation

        Equation getErrorEquation​(String equation,
                                  Class<?> type,
                                  String errorMessage)
        A factory method that returns an Equation that always fails at runtime. The reason for why this exists is that the returned error equations can substitute for real equations as dummies.
        equation - an arbitrary string that is usually a syntactically invalid equation
        type - the return type of the error equation
        errorMessage - the runtime error message that the returned equation will produce
        the error equation
      • getParser

        EquationParser getParser()
        Returns the parser which can be used for checking the syntax of equations.
        the parser used by the compiler