Package org.cytoscape.equations
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 Summary
Modifier and TypeMethodDescriptionReturns a map of variable names to their default values, if any.int
If parse() failed, this will return the index in the equation where the error was encountered.If parse() failed, this will return the last error messages.getFunction
(String functionName) Returns the function associated with the name "functionName" or null if no such function exists.Returns the parse tree.Returns the set of currently registered functions.Class<?>
getType()
Returns the result type of the parsed equation if the parse succeeded, otherwise null.Returns all the variable names that have been detected in the most recently parsed equation.boolean
Returns true if the parse succeeded otherwise falsevoid
registerFunction
(Function func) Deprecated.Functions registered using this method will work, but will not update properly if the containing bundle is updated.
-
Method Details
-
registerFunction
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
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
Returns the set of currently registered functions.- Returns:
- the set of currently registered functions
-
parse
Returns true if the parse succeeded otherwise false- Parameters:
eqn
- a valid attribute equation which must start with an equal signattribNameToTypeMap
- 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
-
getErrorLocation
int getErrorLocation()If parse() failed, this will return the index in the equation where the error was encountered. The value -1 is returned if the parse did not fail or if the error location could not be determined.- Returns:
- the error location
-
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
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.
-