Class EquationUtil


  • public final class EquationUtil
    extends Object
    Various static utility methods relating to equations.

    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 (Static Class): This class is static and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
    • Method Detail

      • attribNameAsReference

        public static String attribNameAsReference​(String attribName)
        Converts a bare name to a variable reference.
        Parameters:
        attribName - the bare name that will be converted
        Returns:
        "attribName" written as an attribute reference with a leading $-sign
      • doubleToLong

        public static long doubleToLong​(double d)
        Checked conversion of a double to a long following the Excel™ rules.
        Parameters:
        d - the number that will be converted
        Returns:
        "d" converted to a Long using Excel™ rules
        Throws:
        IllegalArgumentException - if "d" is outside the range of a long
      • refreshEquations

        public static void refreshEquations​(CyTable table,
                                            EquationCompiler compiler)
        Refreshes all the equations in the given CyTable
        Parameters:
        table - the CyTable
        compiler - an EquationCompiler
      • eqnTypeIsCompatible

        public static boolean eqnTypeIsCompatible​(Class<?> columnType,
                                                  Class<?> listElementType,
                                                  Class<?> eqnType)
        Returns whether the given column type is compatible with an equation type
        Parameters:
        columnType - the column type
        listElementType - the list element type, if columnType is List
        eqnType - the equation type
        Returns:
        true if the types are compatible, false if incompatible
      • getUnqualifiedName

        public static String getUnqualifiedName​(Class<?> type)
        Returns the unqualified name of the given class
        Parameters:
        type - a Class object
        Returns:
        the unqualified name of the class as a String