Interface EquationParser


  • public interface EquationParser
    Parser for a string representing an equation.

    Module: equations-api

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

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>equations-api</artifactId>
    </dependency>

    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

      • registerFunction

        @Deprecated
        void registerFunction​(Function func)
                       throws IllegalArgumentException
        Deprecated.
        Functions registered using this method will work, but will not update properly if the containing bundle is updated. To register a Function, please use CyActivator or CyServiceRegistrar's registerService method to register as a service so updates can be handled properly.
        Parameters:
        func - the function that will be registered
        Throws:
        IllegalArgumentException - will be thrown if "func" is null or the function has previously been registered
      • getFunction

        Function getFunction​(String functionName)
        Returns the function associated with the name "functionName" or null if no such function exists.
        Parameters:
        functionName - the name of the function to get.
        Returns:
        the function associated with the name "functionName" or null if no such function exists.
      • getRegisteredFunctions

        Set<Function> getRegisteredFunctions()
        Returns the set of currently registered functions.
        Returns:
        the set of currently registered functions
      • parse

        boolean parse​(String eqn,
                      Map<String,​Class<?>> attribNameToTypeMap)
        Returns true if the parse succeeded otherwise false
        Parameters:
        eqn - a valid attribute equation which must start with an equal sign
        attribNameToTypeMap - a list of existing attribute names and their types
        Returns:
        true if the parse succeeded otherwise false
      • getType

        Class<?> getType()
        Returns the result type of the parsed equation if the parse succeeded, otherwise null.
        Returns:
        the result type of the parsed equation if the parse succeeded, otherwise null.
      • getErrorMsg

        String getErrorMsg()
        If parse() failed, this will return the last error messages.
        Returns:
        the last error message of null
      • getVariableReferences

        Set<String> getVariableReferences()
        Returns all the variable names that have been detected in the most recently parsed equation.
        Returns:
        all the variable names that have been detected in the most recently parsed equation.
      • getDefaultVariableValues

        Map<String,​Object> getDefaultVariableValues()
        Returns a map of variable names to their default values, if any.
        Returns:
        a map of variable names to their default values, if any.
      • getParseTree

        TreeNode getParseTree()
        Returns the parse tree. Must only be called if parse() returns true!
        Returns:
        the parse tree.