public class UtilFns extends Object
Modifier and Type | Field and Description |
---|---|
static Calendar |
CAL_GMT |
static TimeZone |
TZ_GMT |
Constructor and Description |
---|
UtilFns() |
Modifier and Type | Method and Description |
---|---|
static double |
basisToDouble(int basis,
Date settle,
Date maturi,
int dsm) |
static Complex |
cToComplex(org.apache.commons.math.complex.Complex c,
String suffix)
Convert the complex to complex.
|
static Long |
dateToDays(Date date)
Returns number of days since 1900-1-0; i.e.
|
static Date |
daysToDate(int arg)
Returns a
Date of a given number of days since 1900-1-1 (inclusive); i.e. |
static int |
dsm(Date settle,
Date maturi,
int basis) |
static String |
format(Complex c)
format Complex number to match Excel format
|
static org.apache.commons.math.stat.regression.SimpleRegression |
getRegre(double[] xs,
double[] ys)
Return a commons math Regression class
|
static org.apache.commons.math.stat.descriptive.DescriptiveStatistics |
getStats(double[] d)
Return a commons math DescriptiveStatistics class which is contructed from double array d
|
static String |
padZero(String num,
int places) |
static String |
replaceiToi1(String complex,
String suffix)
Replace the String i to i1.
|
static boolean |
stringToBoolean(ValueEval arg) |
static Date |
stringToDate(ValueEval arg)
Convert a String to Date
|
static Double |
stringToDouble(String str,
boolean nullable)
Convert a string to double
|
static double |
toDouble15(double dbl,
int roundingMode) |
static double[] |
toDoubleArray(List ls)
Convert a list to a double array
|
static double[] |
toDoubleArray(Object[] objs)
Convert an object array to a double array
|
static double[][] |
toDoubleMatrix(ValueEval arg,
int srcRowIndex,
int srcColumnIndex) |
static int[] |
toIntArray(Object[] objs)
Convert an object array to an int array
|
static List |
toList(ValueEval[] args,
int srcRowIndex,
int srcColumnIndex) |
static Complex |
validateComplex(String complex)
Validate given String value, return associated complex.
|
public static final TimeZone TZ_GMT
public static final Calendar CAL_GMT
public static Date stringToDate(ValueEval arg) throws EvaluationException
arg
- - input valueEvaluationException
public static boolean stringToBoolean(ValueEval arg) throws EvaluationException
EvaluationException
public static int dsm(Date settle, Date maturi, int basis) throws EvaluationException
EvaluationException
public static Long dateToDays(Date date)
date
- the date to be calculated.public static String padZero(String num, int places) throws EvaluationException
EvaluationException
public static String replaceiToi1(String complex, String suffix)
complex
- String of complex.public static Complex validateComplex(String complex) throws EvaluationException
ErrorEval.NUM_ERROR
if complex is not a format of complex.complex
- String value to be validated.EvaluationException
public static Complex cToComplex(org.apache.commons.math.complex.Complex c, String suffix)
c
- the complex.suffix
- the suffix.public static String format(Complex c)
c
- the complex numberpublic static int[] toIntArray(Object[] objs) throws EvaluationException
objs
- an object arrayEvaluationException
public static double[][] toDoubleMatrix(ValueEval arg, int srcRowIndex, int srcColumnIndex) throws EvaluationException
EvaluationException
public static double toDouble15(double dbl, int roundingMode)
public static List toList(ValueEval[] args, int srcRowIndex, int srcColumnIndex) throws EvaluationException
EvaluationException
public static Double stringToDouble(String str, boolean nullable) throws EvaluationException
str
- - input valuenullable
- - flag to indicate the return could be null or notEvaluationException
public static double[] toDoubleArray(List ls) throws EvaluationException
ls
- a listEvaluationException
public static double[] toDoubleArray(Object[] objs) throws EvaluationException
objs
- an object arrayEvaluationException
public static org.apache.commons.math.stat.descriptive.DescriptiveStatistics getStats(double[] d)
d
- samplespublic static org.apache.commons.math.stat.regression.SimpleRegression getRegre(double[] xs, double[] ys) throws EvaluationException
xs
- x-coordinatesys
- y-coordinatesEvaluationException
Copyright © 2020. All rights reserved.