public class Functions extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Functions.CompareMode
compare mode
|
| Modifier and Type | Method and Description |
|---|---|
static String |
acos(String value)
Returns the arc cosine of a value; the returned angle is in the range 0.0
through pi.
|
static String |
asin(String value)
Returns the arc sine of a value; the returned angle is in the range
-pi/2 through pi/2.
|
static String |
atan(String value)
Returns the arc tangent of a value; the returned angle is in the range
-pi/2 through pi/2.
|
static String |
average(int scale,
String... values)
Get the average of all input numbers with given scale.
|
static String |
average(String... values)
Get the average of all input numbers.
|
static String |
calcDAP(String date,
String pdate) |
static String |
checkPctVal(String pctVal) |
static boolean |
clearDirectory(File dir) |
static boolean |
compare(String v1,
String v2,
Functions.CompareMode mode)
Compare the input number by given mode The scale will depends on the
scale of input number when the result is indivisible
Any numeric string recognized by
BigDecimal is supported. |
static Date |
convertFromAgmipDateString(String agmipDate)
Convert from AgMIP standard date string (YYYYMMDD) to a
Date |
static String |
convertMsToDay(long ms) |
static String |
convertToAgmipDateString(Date date)
Convert from
Date to AgMIP standard date string (YYYYMMDD) |
static String |
cos(String value)
Returns the trigonometric cosine of an angle.
|
static String |
dateOffset(String initial,
String offset)
Offset an AgMIP standard date string (YYYYMMDD) by a set number of days.
|
static String |
divide(String dividend,
String divisor)
Get the result of dividend divided by divisor.
|
static String |
divide(String dividend,
String divisor,
int scale)
Get the result of dividend divided by divisor with given scale.
|
static String |
exp(String exponent)
Returns Euler's number e raised to the power of a
double
value. |
static String |
formatAgmipDateString(String agmipDate,
String format)
Convert from AgMIP standard date string (YYMMDD) to a custom date string
|
static String |
getStackTrace(Throwable aThrowable)
Gathering the messages from a
Throwable instance and its back
trace |
static String |
log(String val)
Returns the natural logarithm (base e) of a
double value. |
static String |
max(String... values)
Returns the maximum number from a group of input value.
|
static String |
min(String... values)
Returns the minimum number from a group of input value.
|
static String |
multiply(String f1,
String f2)
Multiply two numbers together
Any numeric string recognized by
BigDecimal is supported. |
static String |
numericOffset(String initial,
String offset)
Offset a numeric string by another numeric string.
|
static BigInteger |
numericStringToBigInteger(String numeric)
Converts a numeric string to a
BigInteger. |
static BigInteger |
numericStringToBigInteger(String numeric,
boolean round)
Converts a numeric string to a
BigInteger. |
static String |
pow(String base,
String exponent)
Returns the value of the first argument raised to the power of the second
argument.
|
static String |
product(String... factors)
Get the product of all input numbers
Any numeric string recognized by
BigDecimal is supported. |
static String[] |
removeNull(String[] in)
Remove the null value in the input String array
|
static String |
revisePath(String path)
Revise output path
|
static String |
round(String value,
int scale)
Returns the closest
decimal to the argument, with given scale,
using HALF_UP mode
Any numeric string recognized by BigDecimal is supported. |
static String |
sin(String value)
Returns the trigonometric sine of an angle.
|
static String |
sqrt(String value)
Returns the correctly rounded positive square root of a
double
value. |
static String |
substract(String minuend,
String... subtrahends)
Get the difference of minuend and all subtrahends
Any numeric string recognized by
BigDecimal is supported. |
static String |
sum(String... addends)
Get the sum of all input numbers
Any numeric string recognized by
BigDecimal is supported. |
static String |
tan(String value)
Returns the trigonometric tangent of an angle.
|
static String |
yearOffset(String initial,
String offset)
Offset an AgMIP standard date string (YYYYMMDD) by a set number of years.
|
public static BigInteger numericStringToBigInteger(String numeric)
BigInteger.
This function first converts to a BigDecimal to make sure the
base number being used is accurate. By default, this method uses the
ROUND_HALF_UP rounding method from BigDecimal. If the string
cannot be converted, this method returns nullnumeric - A numeric string (with or without decimals).BigInteger representation of the string or null.BigDecimalpublic static BigInteger numericStringToBigInteger(String numeric, boolean round)
BigInteger.
This function first converts to a BigDecimal to make sure the
base number being used is accurate. If round is set to
true this method uses the ROUND_HALF_UP rounding
method from BigDecimal. Otherwise the decimal part is dropped. If
the string cannot be converted, this method returns nullnumeric - A numeric string (with or without decimals).round - Use BigDecimal.ROUND_HALF_UP method.BigInteger representation of the string or nullBigDecimalpublic static Date convertFromAgmipDateString(String agmipDate)
DateagmipDate - AgMIP standard date stringDate represented by the AgMIP date string or nullpublic static String convertToAgmipDateString(Date date)
Date to AgMIP standard date string (YYYYMMDD)date - Date objectdate.public static String formatAgmipDateString(String agmipDate, String format)
agmipDate - AgMIP standard date stringformat - Destination formatnullpublic static String convertMsToDay(long ms)
public static String dateOffset(String initial, String offset)
initial - AgMIP standard date stringoffset - number of days to offset (can be positive or negative
integer)initial + offsetpublic static String yearOffset(String initial, String offset)
initial - AgMIP standard date stringoffset - number of years to offset (can be positive or negative
integer)initial + offsetpublic static String numericOffset(String initial, String offset)
BigDecimal is supported.initial - A valid number stringoffset - A valid number stringBigDecimalpublic static String multiply(String f1, String f2)
BigDecimal is supported.f1 - A valid number stringf2 - A valid number stringf1*f2BigDecimalpublic static String sum(String... addends)
BigDecimal is supported.addends - one or more valid number stringsaddends[0] + addends[1] + ...BigDecimalpublic static String substract(String minuend, String... subtrahends)
BigDecimal is supported.minuend - A valid number stringsubtrahends - one or more valid number stringsminuend - subtrahends[0] - subtrahends[1] - ...BigDecimalpublic static String product(String... factors)
BigDecimal is supported.factors - one or more valid number stringsfactors[0] * factors[1] * ...BigDecimalpublic static String divide(String dividend, String divisor)
BigDecimal is supported.dividend - A valid number stringdivisor - A valid number stringsdividend / divisorBigDecimalpublic static String divide(String dividend, String divisor, int scale)
BigDecimal is supported.dividend - A valid number stringdivisor - A valid number stringsscale - scale of the BigDecimal quotient to be returned.dividend / divisorBigDecimalpublic static String average(String... values)
BigDecimal is supported.values - one or more valid number strings(values[0] + values[1] + ...) / values.lengthBigDecimalpublic static String average(int scale, String... values)
BigDecimal is supported.scale - of the BigDecimal quotient to be returned.values - one or more valid number strings(values[0] + values[1] + ...) / values.lengthBigDecimalpublic static String exp(String exponent)
double
value.
Any numeric string recognized by BigDecimal is supported.exponent - A valid number stringvalue, where e is the
base of the natural logarithms.BigDecimalpublic static String log(String val)
double value.
Any numeric string recognized by BigDecimal is supported.val - A valid number stringa, the natural logarithm of a.BigDecimalpublic static String min(String... values)
BigDecimal is supported.values - One of more valid number stringsBigDecimalpublic static String max(String... values)
BigDecimal is supported.values - One of more valid number stringsBigDecimalpublic static String pow(String base, String exponent)
BigDecimal is supported.base - the base.exponent - the exponent.baseexponent.public static String sqrt(String value)
double
value.
Any numeric string recognized by BigDecimal is supported.value - A valid numbervalue.public static String cos(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String sin(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String tan(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String acos(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String asin(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String atan(String value)
BigDecimal is supported.value - A valid number for an angle, in radianspublic static String round(String value, int scale)
decimal to the argument, with given scale,
using HALF_UP mode
Any numeric string recognized by BigDecimal is supported.value - A valid number stringBigDecimalpublic static boolean compare(String v1, String v2, Functions.CompareMode mode)
BigDecimal is supported.v1 - A valid number stringsv2 - A valid number stringsmode - The compare modeBigDecimalpublic static String getStackTrace(Throwable aThrowable)
Throwable instance and its back
traceaThrowable - public static String[] removeNull(String[] in)
in - The input String valuespublic static boolean clearDirectory(File dir)
Copyright © 2014. All Rights Reserved.