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