|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cytoscape.equations.FunctionUtil
public class FunctionUtil
A collection of static methods that may be useful for the implementation of built-in functions.
Constructor Summary | |
---|---|
FunctionUtil()
|
Method Summary | |
---|---|
static void |
addScalarArgumentTypes(List<Class> argTypes)
Adds Double.class, Long.class, String.class and Boolean.class to "argTypes". |
static double |
calcSampleVariance(double[] x)
|
static boolean |
getArgAsBoolean(Object arg)
Assumes that "arg" is a "String", "Boolean", "Long" or a "Double and converts it to "boolean". |
static double |
getArgAsDouble(Object arg)
Assumes that "arg" is a "String", "Boolean", "Long" or a "Double and converts it to "double". |
static long |
getArgAsLong(Object arg)
Assumes that "arg" is a "String", "Boolean", "Long" or a "Double and converts it to "long". |
static String |
getArgAsString(Object arg)
Assumes that "arg" is a "String", "Boolean", "Long" or a "Double and converts it to "double". |
static boolean[] |
getBooleans(Object[] args)
Attempts to convert all arguments, including Lists to a uniform array of booleans. |
static double[] |
getDoubles(Object[] args)
Attempts to convert all arguments, including Lists to a uniform array of doubles. |
static long[] |
getLongs(Object[] args)
Attempts to convert all arguments, including Lists to a uniform array of longs. |
static String |
getOrdinal(int i)
|
static String[] |
getStrings(Object[] args)
Converts all arguments, including Lists to a uniform array of strings. |
static boolean |
isScalarArgType(Class type)
|
static boolean |
isSomeKindOfList(Class listClassCandidate)
|
static double[] |
listToArray(List<Double> a)
Converts a List |
static double |
numericallySafeSum(double[] a)
Carefully adds the numbers in "a" minimising loss of precision. |
static Object |
translateObjectType(Object input)
Tries to map "input" to one of Double, Long, Boolean or String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FunctionUtil()
Method Detail |
---|
public static double getArgAsDouble(Object arg) throws IllegalArgumentException
IllegalArgumentException
- if the argument cannot be converted to a "double"public static String getArgAsString(Object arg) throws IllegalArgumentException
IllegalArgumentException
- if the argument cannot be converted to a "double"public static long getArgAsLong(Object arg) throws IllegalArgumentException
IllegalArgumentException
- if the argument cannot be converted to a "long"public static boolean getArgAsBoolean(Object arg) throws IllegalArgumentException
IllegalArgumentException
- if the argument cannot be converted to a "boolean"public static double numericallySafeSum(double[] a)
public static String getOrdinal(int i)
public static double calcSampleVariance(double[] x)
public static double[] listToArray(List<Double> a)
public static boolean isScalarArgType(Class type)
public static boolean isSomeKindOfList(Class listClassCandidate)
public static void addScalarArgumentTypes(List<Class> argTypes)
public static double[] getDoubles(Object[] args) throws FunctionError
IllegalArgumentException
- if any scalar argument cannot be converted to a double or any list
argument contains an element that cannot be converted to a number.
FunctionError
public static long[] getLongs(Object[] args) throws FunctionError
IllegalArgumentException
- if any scalar argument cannot be converted to a long or any list
argument contains an element that cannot be converted to a number.
FunctionError
public static String[] getStrings(Object[] args)
public static boolean[] getBooleans(Object[] args) throws FunctionError
IllegalArgumentException
- if any scalar argument cannot be converted to a boolean or any list
argument contains an element that cannot be converted to a number.
FunctionError
public static Object translateObjectType(Object input)
|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |