public class CMath
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
CMath.CompiledFormula |
A class representing a a list of compiled operation in a complete formula.
|
static class |
CMath.CompiledOperation |
A class representing a single piece of a compiled operation.
|
Modifier and Type | Field | Description |
---|---|---|
static java.math.BigDecimal |
BIG_PI |
|
static java.util.Random |
NotRandomHigh |
A class that extends Random, only it always returns the highest possible
values for each method.
|
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
abbreviateLong(long l) |
Returns an abbreviation of the given long, giving 2 significant digits
after the decimal, and returning k, M, G, T, P, or E for the power base 1000.
|
static double |
abs(double d) |
|
static float |
abs(float d) |
|
static int |
abs(int val) |
Returns the absolute value (X>=0) of the
given number
|
static long |
abs(long val) |
Returns the absolute value (X>=0) of the
given number
|
static long |
absDiff(long x,
long y) |
Returns the absolute difference between two numbers
|
static java.lang.String |
appendNumAppendage(int num) |
Append st,nd,rd for a number
|
static java.util.List<? extends java.lang.Object> |
asList(boolean[] xs) |
Converts a primitive array to an object array of the
same object type
|
static java.util.List<? extends java.lang.Object> |
asList(double[] xs) |
Converts a primitive array to an object array of the
same object type
|
static java.util.List<? extends java.lang.Object> |
asList(float[] xs) |
Converts a primitive array to an object array of the
same object type
|
static java.util.List<? extends java.lang.Object> |
asList(int[] xs) |
Converts a primitive array to an object array of the
same object type
|
static java.util.List<? extends java.lang.Object> |
asList(long[] xs) |
Converts a primitive array to an object array of the
same object type
|
static boolean |
banyset(int num,
int bitmask) |
Returns true if any of the bits represented
by the given bitmask are set in the given
number.
|
static boolean |
banyset(long num,
int bitmask) |
Returns true if any of the bits represented
by the given bitmask are set in the given
number.
|
static boolean |
banyset(long num,
long bitmask) |
Returns true if any of the bits represented
by the given bitmask are set in the given
number.
|
static boolean |
between(int val,
int from,
int to) |
Returns whether the given value is between the from and to values
(inclusive!).
|
static java.math.BigInteger |
bigMultiply(double l1,
long l2) |
Generates a big integer from multiply two numbers, rounding when necessary
|
static java.math.BigInteger |
bigMultiply(long l1,
long l2) |
Generates a big integer from multiply two longs
|
static int |
bitNumber(long mask) |
Returns the first set bit number of the bitmask given
|
static boolean |
bset(int num,
int bitmask) |
Returns true if the given number has the bits
represented by the given bitmask set.
|
static boolean |
bset(long num,
int bitmask) |
Returns true if the given number has the bits
represented by the given bitmask set.
|
static boolean |
bset(long num,
long bitmask) |
Returns true if the given number has the bits
represented by the given bitmask set.
|
static boolean |
bset(short num,
short bitmask) |
Returns true if the given number has the bits
represented by the given bitmask set.
|
static double |
ceiling(double d) |
|
static float |
ceiling(float d) |
|
static CMath.CompiledFormula |
compileMathExpression(java.lang.String formula) |
Pre-compiles an expression for faster evaluation later on.
|
static int |
convertFromRoman(java.lang.String s) |
Convert a number from roman numeral to integer.
|
static java.lang.String |
convertToRoman(int i) |
Convert an integer to its Roman Numeral equivalent
Usage: Return=convertToRoman(Number)+".";
|
static double |
div(double a,
double b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(double a,
int b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(double a,
long b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(int a,
double b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(int a,
int b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(long a,
double b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
div(long a,
long b) |
Divide a by b, making sure both are cast to doubles
and that the return is precisely double.
|
static int |
dobit(int num,
int bitmask,
boolean setOrUnSet) |
Sets or Unsets those bits in the given number which are
turned ON or OFF in the given bitmask.
|
protected double |
doOperation(char operation,
double finalValue,
double curValue) |
Performs the operation between the finalValue and the curValue.
|
static int |
firstBitSetIndex(int bits) |
Returns the bit index (0 based) of the first bit set in the given mask.
|
static double |
floor(double d) |
|
static float |
floor(float d) |
|
static int[] |
getAllBitsSet(int bits) |
Returns the bit index (0 based) of the first bit set in the given mask.
|
static java.util.Map.Entry<java.lang.Integer,java.lang.String> |
getNumberFollowedByString(java.lang.String str) |
Returns a number/string pair built from a given string, if it is a string with
a number followed by one or more characters.
|
static int[] |
getSeparateBitMasks(int mask) |
Given a bitmask, separates the mask according to which
bits are set and returns those original values in an
array where each entry is the value of each bit
|
static long[] |
getSeparateBitMasks(long mask) |
Given a bitmask, separates the mask according to which
bits are set and returns those original values in an
array where each entry is the value of each bit
|
static java.util.Map.Entry<java.lang.String,java.lang.Integer> |
getStringFollowedByNumber(java.lang.String str,
boolean romanOK) |
If the given string is 1 or more characters followed by decimal digits, this will return a Map.Entry
with those parts separated.
|
static double |
greater(double a,
double b) |
Returns greater of two numbers
|
static int |
hexDigit(char c) |
Converts a single hex digit to an int
|
static CMath |
instance() |
|
static boolean |
isBool(java.lang.String BOOL) |
Returns whether the given string is a boolean value
Usage: if(isBool(CMD.substring(14)));
|
static boolean |
isDouble(java.lang.String DBL) |
Returns whether the given string is a double value
Usage: if(isDouble(CMD.substring(14)));
|
static boolean |
isFloat(java.lang.String DBL) |
Returns whether the given string is a float value
Usage: if(isFloat(CMD.substring(14)));
|
static boolean |
isInteger(java.lang.String INT) |
Returns whether the given string is a int value
Usage: if(isInteger(CMD.substring(14)));
|
static boolean |
isLong(java.lang.String LONG) |
Returns whether the given string is a long value
Usage: if(isLong(CMD.substring(14)));
|
static boolean |
isMathExpression(java.lang.String st) |
Returns whether the given string is a valid
math expression (5 + 7)/2, etc.
|
static boolean |
isMathExpression(java.lang.String st,
double[] vars) |
Returns whether the given string is a valid
math expression (@x1 + 7)/2, etc.
|
static boolean |
isNumber(java.lang.String s) |
Returns true if the string is a number (float or int)
|
static boolean |
isNumberFollowedByString(java.lang.String str) |
Returns whether the given string is a number followed
by 1 or more characters.
|
static boolean |
isPct(java.lang.String s) |
Returns true if the given string represents a
percentage in the form X% where X is any real
number.
|
static boolean |
isRomanDigit(char c) |
Return true if the char is a roman numeral digit
|
static boolean |
isRomanNumeral(java.lang.String s) |
Returns true if the string is a roman numeral
|
static boolean |
isSet(int number,
int bitnumber) |
Returns true if the bitnumberth bit (0...) is set
in the given number
|
static boolean |
isSet(long number,
int bitnumber) |
Returns true if the bitnumberth bit (0...) is set
in the given number
|
static double |
mul(double a,
double b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
mul(double a,
int b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
mul(double a,
long b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
mul(int a,
double b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static int |
mul(int a,
int b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static double |
mul(long a,
double b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static long |
mul(long a,
long b) |
Multiply a and b, making sure both are cast to doubles
and that the return is precisely double.
|
static java.lang.String |
numAppendage(int num) |
Return st,nd,rd for a number
|
static int |
numberOfSetBits(int i) |
Returns how many bits are set in the given 32 bit int
|
static int |
numberOfSetBits(long i) |
Returns how many bits are set in the given 64 bit long
|
static int |
parseIntExpression(java.lang.String formula) |
Returns the result of evaluating the given math
expression.
|
static int |
parseIntExpression(java.lang.String formula,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static long |
parseLongExpression(java.lang.String formula) |
Returns the result of evaluating the given math
expression.
|
static long |
parseLongExpression(java.lang.String formula,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static double |
parseMathExpression(CMath.CompiledFormula list,
double[] vars,
double previous) |
Parse a pre-compiled expression.
|
static double |
parseMathExpression(CMath.CompiledFormula list,
java.util.Random rand,
double[] vars,
double previous) |
Parse a pre-compiled expression.
|
static double |
parseMathExpression(java.lang.String formula) |
Returns the result of evaluating the given math
expression.
|
static double |
parseMathExpression(java.lang.String formula,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static double |
pctDiff(double d1,
double d2,
double range) |
Returns the pct of difference between the two
given numbers, given the range.
|
static double |
posMin(double a,
double b) |
Returns the smaller of the two numbers that is
greater than or equal to 0.
|
static int |
posMin(int a,
int b) |
Returns the smaller of the two numbers that is
greater than or equal to 0.
|
static long |
posMin(long a,
long b) |
Returns the smaller of the two numbers that is
greater than or equal to 0.
|
static long |
pow(long x,
long y) |
Raises x to the y power, making sure both are cast to doubles
and that the return is rounded off.
|
static double |
random() |
|
static void |
replaceVariables(java.lang.StringBuffer str,
double[] values) |
Replaces @x1 type variables inside a stringbuffer with an actual value
Not used in the main expression system, this is a stand alone function
Also uniquely, supports @x numbers above 10.
|
static java.lang.String |
replaceVariables(java.lang.String str,
double[] values) |
Replaces @x1 type variables inside a stringbuffer with an actual value
Not used in the main expression system, this is a stand alone function
Also uniquely, supports @x numbers above 10.
|
static long |
round(double d) |
|
static double |
round(double d,
int precision) |
Rounds to specified precision
|
static long |
round(float d) |
|
static float |
round(float d,
int precision) |
Rounds to specified precision
|
static boolean |
s_bool(java.lang.String BOOL) |
Returns the boolean value of a string without crashing
Usage: int num=s_bool(CMD.substring(14));
|
static double |
s_double(java.lang.String DOUBLE) |
Returns the double value of a string without crashing
Usage: dSize = WebIQBase.s_double(WebIQBase.getRes(AttStatsRes,"BlobSize"));
|
static float |
s_float(java.lang.String FLOAT) |
Returns the floating point value of a string without crashing
Usage: lSize = WebIQBase.s_float(WebIQBase.getRes(AttStatsRes,"BlobSize"));
|
static int |
s_int(java.lang.String INT) |
Returns the integer value of a string without crashing
Usage: int num=s_int(CMD.substring(14));
|
static int |
s_int(java.lang.String INT,
int def) |
Returns the integer value of a string without crashing
Usage: int num=s_int(CMD.substring(14));
|
static int |
s_intOf(java.lang.Object O) |
Converts the given object into an iteger, if it can
|
static long |
s_long(java.lang.String LONG) |
Returns the long value of a string without crashing
Usage: lSize = WebIQBase.s_long(WebIQBase.getRes(AttStatsRes,"BlobSize"));
|
static int |
s_parseBitIntExpression(java.lang.String[] bits,
java.lang.String val) |
Returns a int representing either the given value, or
the 2^ power of the comma separated values in the order
they appear in the given string list.
|
static long |
s_parseBitLongExpression(java.lang.String[] bits,
java.lang.String val) |
Returns a long representing either the given value, or
the 2^ power of the comma separated values in the order
they appear in the given string list.
|
static int |
s_parseIntExpression(java.lang.String st) |
Returns the result of evaluating the given math
expression.
|
static int |
s_parseIntExpression(java.lang.String st,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static int |
s_parseListIntExpression(java.lang.String[] descs,
java.lang.String val) |
Returns a int representing either the given value, or
the index of the value in the order
they appear in the given string list.
|
static long |
s_parseListLongExpression(java.lang.String[] descs,
java.lang.String val) |
Returns a long representing either the given value, or
the index of the value in the order
they appear in the given string list.
|
static long |
s_parseLongExpression(java.lang.String st) |
Returns the result of evaluating the given math
expression.
|
static long |
s_parseLongExpression(java.lang.String st,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static double |
s_parseMathExpression(java.lang.String st) |
Returns the result of evaluating the given math
expression.
|
static double |
s_parseMathExpression(java.lang.String st,
double[] vars) |
Returns the result of evaluating the given math
expression.
|
static double |
s_pct(java.lang.String s) |
Converts the given string to a floating
point number, 1>=N>=0, representing
the whole percentage of the string.
|
static short |
s_short(java.lang.String SHORT) |
Returns the short value of a string without crashing
Usage: int num=s_short(CMD.substring(14));
|
static java.lang.Enum<? extends java.lang.Enum> |
s_valueOf(java.lang.Class<? extends java.lang.Enum> c,
java.lang.String s) |
Returns the matching enum.
|
static java.lang.Enum<? extends java.lang.Enum> |
s_valueOf(java.lang.Class<? extends java.lang.Enum> c,
java.lang.String s,
java.lang.Enum<? extends java.lang.Enum> def) |
Returns the matching enum.
|
static java.lang.Object |
s_valueOf(java.lang.Object[] o,
java.lang.String s) |
Returns which object in the object array is same as the
string, when cast to a string.
|
static java.util.List<java.lang.Enum<? extends java.lang.Enum>> |
s_valuesOf(java.lang.Class<? extends java.lang.Enum> c,
java.util.List<java.lang.String> lst) |
Returns the matching enums.
|
static int |
setb(int num,
int bitmask) |
Returns the given number, after having set the
bits represented by the given bit mask.
|
static long |
setb(long num,
int bitmask) |
Returns the given number, after having set the
bits represented by the given bit mask.
|
static long |
setb(long num,
long bitmask) |
Returns the given number, after having set the
bits represented by the given bit mask.
|
static void |
setRand(java.util.Random rand) |
Replaces the internal Random object with the one
passed in.
|
static double |
sqrt(double d) |
|
static float |
sqrt(float d) |
|
static int |
squared(int x) |
Returns x, squared, after being case to a double
|
static java.lang.String |
toPct(double d) |
Converts a percentage 1>d>0 to a string.
|
static java.lang.String |
toPct(java.lang.String s) |
Converts the string to a double percentage and then
converts that back to a percentage.
|
static java.lang.String |
toWholePct(double d) |
Converts a percentage 1>d>0 to a string.
|
static int |
unsetb(int num,
int bitmask) |
Unsets those bits in the given number which are
turned ON in the given bitmask.
|
static long |
unsetb(long num,
int bitmask) |
Unsets those bits in the given number which are
turned ON in the given bitmask.
|
static long |
unsetb(long num,
long bitmask) |
Unsets those bits in the given number which are
turned ON in the given bitmask.
|
public static java.math.BigDecimal BIG_PI
public static final java.util.Random NotRandomHigh
public static final CMath instance()
public static java.lang.String abbreviateLong(long l)
l
- the long to abbreviatepublic static final java.lang.String convertToRoman(int i)
i
- Integer to convertpublic static final int convertFromRoman(java.lang.String s)
s
- the roman numeral stringpublic static final java.lang.String numAppendage(int num)
num
- the numberpublic static final java.lang.String appendNumAppendage(int num)
num
- the numberpublic static final boolean isRomanDigit(char c)
c
- the charpublic static final boolean isRomanNumeral(java.lang.String s)
s
- the string to testpublic static final long absDiff(long x, long y)
x
- the first numbery
- the second numberpublic static final java.lang.Object s_valueOf(java.lang.Object[] o, java.lang.String s)
o
- array of objectss
- the string to lookpublic static int numberOfSetBits(long i)
i
- the long to count bits inpublic static int numberOfSetBits(int i)
i
- the int to count bits inpublic static final java.lang.Enum<? extends java.lang.Enum> s_valueOf(java.lang.Class<? extends java.lang.Enum> c, java.lang.String s)
c
- the enum class to look ins
- the string to lookpublic static final java.util.List<java.lang.Enum<? extends java.lang.Enum>> s_valuesOf(java.lang.Class<? extends java.lang.Enum> c, java.util.List<java.lang.String> lst)
c
- the enum class to look inlst
- the list of strings to lookpublic static final java.lang.Enum<? extends java.lang.Enum> s_valueOf(java.lang.Class<? extends java.lang.Enum> c, java.lang.String s, java.lang.Enum<? extends java.lang.Enum> def)
c
- the enum class to look ins
- the string to lookdef
- the value to use when nullpublic static final boolean isNumber(java.lang.String s)
s
- the string to testpublic static final double div(double a, double b)
a
- the dividendb
- the divisorpublic static final double div(double a, int b)
a
- the dividendb
- the divisorpublic static final double div(int a, double b)
a
- the dividendb
- the divisorpublic static final double div(double a, long b)
a
- the dividendb
- the divisorpublic static final double div(long a, double b)
a
- the dividendb
- the divisorpublic static final double mul(double a, double b)
a
- the first numberb
- the second numberpublic static final double mul(double a, int b)
a
- the first numberb
- the second numberpublic static final double mul(int a, double b)
a
- the first numberb
- the second numberpublic static final double mul(double a, long b)
a
- the first numberb
- the second numberpublic static final long posMin(long a, long b)
a
- the first numberb
- the second numberpublic static final int posMin(int a, int b)
a
- the first numberb
- the second numberpublic static final double posMin(double a, double b)
a
- the first numberb
- the second numberpublic static final double mul(long a, double b)
a
- the first numberb
- the second numberpublic static final long mul(long a, long b)
a
- the first numberb
- the second numberpublic static final int mul(int a, int b)
a
- the first numberb
- the second numberpublic static final double div(long a, long b)
a
- the dividendb
- the divisorpublic static final double div(int a, int b)
a
- the dividendb
- the divisorpublic static final long pow(long x, long y)
x
- the base numbery
- the powerpublic static final int squared(int x)
x
- the number to squarepublic static final boolean bset(short num, short bitmask)
num
- the numberbitmask
- the bit maskpublic static final boolean bset(int num, int bitmask)
num
- the numberbitmask
- the bit maskpublic static final boolean bset(long num, long bitmask)
num
- the numberbitmask
- the bit maskpublic static final boolean bset(long num, int bitmask)
num
- the numberbitmask
- the bit maskpublic static final int setb(int num, int bitmask)
num
- the numberbitmask
- the bitmaskpublic static final boolean banyset(int num, int bitmask)
num
- the given numberbitmask
- the bitmask of bits to checkpublic static final boolean banyset(long num, long bitmask)
num
- the given numberbitmask
- the bitmask of bits to checkpublic static final boolean banyset(long num, int bitmask)
num
- the given numberbitmask
- the bitmask of bits to checkpublic static final long setb(long num, int bitmask)
num
- the numberbitmask
- the bitmaskpublic static final long setb(long num, long bitmask)
num
- the numberbitmask
- the bitmaskpublic static final int unsetb(int num, int bitmask)
num
- the given numberbitmask
- the given bitmaskpublic static final int dobit(int num, int bitmask, boolean setOrUnSet)
num
- the given numberbitmask
- the given bitmasksetOrUnSet
- true to set the bit, false otherwisepublic static final long unsetb(long num, long bitmask)
num
- the given numberbitmask
- the given bitmaskpublic static final long unsetb(long num, int bitmask)
num
- the given numberbitmask
- the given bitmaskpublic static final int firstBitSetIndex(int bits)
bits
- the bits to checkpublic static final int[] getAllBitsSet(int bits)
bits
- the bits to checkpublic static final int[] getSeparateBitMasks(int mask)
mask
- the mask to separatepublic static final long[] getSeparateBitMasks(long mask)
mask
- the mask to separatepublic static final boolean isSet(int number, int bitnumber)
number
- the given numberbitnumber
- the bit to check (0,1,2...)public static final boolean isPct(java.lang.String s)
s
- the string to checkpublic static final void replaceVariables(java.lang.StringBuffer str, double[] values)
str
- the stringbuffer to assessvalues
- values to replace each variable withpublic static final java.lang.String replaceVariables(java.lang.String str, double[] values)
str
- the stringbuffer to assessvalues
- values to replace each variable withpublic static final int hexDigit(char c)
c
- the hex digit, maybepublic static final double s_pct(java.lang.String s)
s
- the string to convertpublic static final java.lang.String toPct(double d)
d
- the number to convertpublic static final java.lang.String toWholePct(double d)
d
- the number to convertpublic static final java.lang.String toPct(java.lang.String s)
s
- the string numberpublic static final double pctDiff(double d1, double d2, double range)
d1
- the first numberd2
- the second numberrange
- the range of the numbers from 0-rangepublic static final boolean isSet(long number, int bitnumber)
number
- the given numberbitnumber
- the bit to check (0,1,2...)public static final boolean isMathExpression(java.lang.String st)
st
- the possible math expressionpublic static final boolean isMathExpression(java.lang.String st, double[] vars)
st
- the possible math expressionvars
- the 0 based variablespublic static final double s_parseMathExpression(java.lang.String st)
st
- a full math expression stringpublic static final double s_parseMathExpression(java.lang.String st, double[] vars)
st
- a full math expression stringvars
- the 0 based variablespublic static final long s_parseLongExpression(java.lang.String st)
st
- a full math expression stringpublic static final long s_parseLongExpression(java.lang.String st, double[] vars)
st
- a full math expression stringvars
- the 0 based variablespublic static final int s_parseIntExpression(java.lang.String st)
st
- a full math expression stringpublic static final int s_parseIntExpression(java.lang.String st, double[] vars)
st
- a full math expression stringvars
- the 0 based variablespublic static final CMath.CompiledFormula compileMathExpression(java.lang.String formula)
formula
- the math expression as a stringjava.lang.ArithmeticException
- a parse error, typically arithmeticparseMathExpression(CompiledFormula, double[], double)
public static final double parseMathExpression(CMath.CompiledFormula list, double[] vars, double previous)
list
- the pre-compiled expressionvars
- the variable valuesprevious
- the previous value, for operators that require itcompileMathExpression(StreamTokenizer, boolean)
public static final double parseMathExpression(CMath.CompiledFormula list, java.util.Random rand, double[] vars, double previous)
list
- the pre-compiled expressionrand
- the random number generator to usevars
- the variable valuesprevious
- the previous value, for operators that require itcompileMathExpression(StreamTokenizer, boolean)
protected double doOperation(char operation, double finalValue, double curValue)
operation
- +, -, etc..finalValue
- the left hand numbercurValue
- the right hand numberpublic static final long parseLongExpression(java.lang.String formula)
formula
- a full math expression stringpublic static final long parseLongExpression(java.lang.String formula, double[] vars)
formula
- a full math expression stringvars
- the 0 based variablespublic static final int parseIntExpression(java.lang.String formula) throws java.lang.ArithmeticException
formula
- a full math expression stringjava.lang.ArithmeticException
- a parse error, typically arithmeticpublic static final int parseIntExpression(java.lang.String formula, double[] vars) throws java.lang.ArithmeticException
formula
- a full math expression stringvars
- the 0 based variablesjava.lang.ArithmeticException
- a parse error, typically arithmeticpublic static final double parseMathExpression(java.lang.String formula) throws java.lang.ArithmeticException
formula
- a full math expression stringjava.lang.ArithmeticException
- a parsing errorpublic static final double parseMathExpression(java.lang.String formula, double[] vars) throws java.lang.ArithmeticException
formula
- a full math expression stringvars
- the 0 based variablesjava.lang.ArithmeticException
- a parsing errorpublic static final long s_long(java.lang.String LONG)
LONG
- String to convertpublic static final float s_float(java.lang.String FLOAT)
FLOAT
- String to convertpublic static final double s_double(java.lang.String DOUBLE)
DOUBLE
- String to convertpublic static final int abs(int val)
val
- the numberpublic static final int bitNumber(long mask)
mask
- the bit mask given.public static final long abs(long val)
val
- the numberpublic static final boolean s_bool(java.lang.String BOOL)
BOOL
- Boolean value of stringpublic static final boolean isBool(java.lang.String BOOL)
BOOL
- Boolean value of stringpublic static final int s_int(java.lang.String INT)
INT
- Integer value of stringpublic static final int s_intOf(java.lang.Object O)
O
- the object to try and convertpublic static final int s_int(java.lang.String INT, int def)
INT
- Integer value of stringdef
- default value if the given string is not an intpublic static final short s_short(java.lang.String SHORT)
SHORT
- Short value of stringpublic static final boolean isLong(java.lang.String LONG)
LONG
- Long value of stringpublic static final boolean isInteger(java.lang.String INT)
INT
- Integer value of stringpublic static final boolean isFloat(java.lang.String DBL)
DBL
- float value of stringpublic static final int s_parseBitIntExpression(java.lang.String[] bits, java.lang.String val)
bits
- the ordered string values from 0-whatever.val
- the expression, or list of string valuespublic static final long s_parseBitLongExpression(java.lang.String[] bits, java.lang.String val)
bits
- the ordered string values from 0-whatever.val
- the expression, or list of string valuespublic static final boolean between(int val, int from, int to)
val
- the valuefrom
- the lowest valid valueto
- the highest valid valuepublic static final void setRand(java.util.Random rand)
rand
- the random object to usepublic static final long s_parseListLongExpression(java.lang.String[] descs, java.lang.String val)
descs
- the ordered string values from 0-whatever.val
- the expression, or list of string valuespublic static final int s_parseListIntExpression(java.lang.String[] descs, java.lang.String val)
descs
- the ordered string values from 0-whatever.val
- the expression, or list of string valuespublic static final boolean isDouble(java.lang.String DBL)
DBL
- double value of stringpublic static final boolean isNumberFollowedByString(java.lang.String str)
str
- the string to checkpublic static final java.util.Map.Entry<java.lang.Integer,java.lang.String> getNumberFollowedByString(java.lang.String str)
str
- the string to checkpublic static final java.util.Map.Entry<java.lang.String,java.lang.Integer> getStringFollowedByNumber(java.lang.String str, boolean romanOK)
str
- the string to checkromanOK
- true to check for roman numerals, false to just check for decimalpublic static final long round(double d)
d
- the real numberMath.round(double)
public static final long round(float d)
d
- the real numberMath.round(float)
public static final double round(double d, int precision)
d
- the real numberprecision
- the precisionMath.round(float)
public static final float round(float d, int precision)
d
- the real numberprecision
- the precisionMath.round(float)
public static final double abs(double d)
d
- the real numberMath.abs(double)
public static final float abs(float d)
d
- the real numberMath.abs(float)
public static final double random()
Math.random()
public static final double floor(double d)
d
- the number to get the floor ofMath.floor(double)
,
ceiling(double)
public static final float floor(float d)
d
- the number to get the floor ofMath.floor(double)
,
ceiling(double)
public static final double ceiling(double d)
d
- the number to get the ceiling ofMath.ceil(double)
,
floor(double)
public static final float ceiling(float d)
d
- the number to get the ceiling ofMath.ceil(double)
,
floor(float)
public static final double sqrt(double d)
d
- the number to get the square root ofMath.sqrt(double)
public static final float sqrt(float d)
d
- the number to get the square root ofMath.sqrt(double)
public static final java.util.List<? extends java.lang.Object> asList(int[] xs)
xs
- the primitive arraypublic static final java.util.List<? extends java.lang.Object> asList(long[] xs)
xs
- the primitive arraypublic static final java.util.List<? extends java.lang.Object> asList(float[] xs)
xs
- the primitive arraypublic static final java.util.List<? extends java.lang.Object> asList(double[] xs)
xs
- the primitive arraypublic static final java.util.List<? extends java.lang.Object> asList(boolean[] xs)
xs
- the primitive arraypublic static final double greater(double a, double b)
a
- first numberb
- second numberpublic static final java.math.BigInteger bigMultiply(long l1, long l2)
l1
- the first longl2
- the second longpublic static final java.math.BigInteger bigMultiply(double l1, long l2)
l1
- the first numberl2
- the second number