com.planet_ink.coffee_mud.core
Class CMath

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.CMath

public class CMath
extends java.lang.Object


Method Summary
 double abs(double d)
           
 float abs(float d)
           
static int abs(int val)
           
static long abs(long val)
           
static long absDiff(long x, long y)
           
static boolean banyset(int num, int bitmask)
           
static boolean banyset(long num, int bitmask)
           
static boolean banyset(long num, long bitmask)
           
static boolean bset(int num, int bitmask)
           
static boolean bset(long num, int bitmask)
           
static boolean bset(long num, long bitmask)
           
static boolean bset(short num, short bitmask)
           
 double ceiling(double d)
           
 float ceiling(float d)
           
static int convertFromRoman(java.lang.String s)
          Convert an integer to its Roman Numeral equivalent Usage: Return=MiscFunc.convertToRoman(Number)+".";
static java.lang.String convertToRoman(int i)
          Convert an integer to its Roman Numeral equivalent Usage: Return=MiscFunc.convertToRoman(Number)+".";
static double div(double a, double b)
           
static double div(double a, int b)
           
static double div(double a, long b)
           
static double div(int a, double b)
           
static double div(int a, int b)
           
static double div(long a, double b)
           
static double div(long a, long b)
           
 double floor(double d)
           
 float floor(float d)
           
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)
           
static boolean isMathExpression(java.lang.String st, double[] vars)
           
static boolean isNumber(java.lang.String s)
           
static boolean isPct(java.lang.String s)
           
static boolean isRomanDigit(char c)
           
static boolean isRomanNumeral(java.lang.String s)
           
static boolean isSet(int number, int bitnumber)
           
static boolean isSet(long number, int bitnumber)
           
static double mul(double a, double b)
           
static double mul(double a, int b)
           
static double mul(double a, long b)
           
static double mul(int a, double b)
           
static int mul(int a, int b)
           
static double mul(long a, double b)
           
static long mul(long a, long b)
           
static java.lang.String numAppendage(int num)
           
static int parseIntExpression(java.lang.String formula)
           
static int parseIntExpression(java.lang.String formula, double[] vars)
           
static long parseLongExpression(java.lang.String formula)
           
static long parseLongExpression(java.lang.String formula, double[] vars)
           
static double parseMathExpression(java.lang.String formula)
           
static double parseMathExpression(java.lang.String formula, double[] vars)
           
static long pow(long x, long y)
           
 double random()
           
 long round(double d)
           
 long round(float d)
           
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 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_parseIntExpression(java.lang.String st)
           
static int s_parseIntExpression(java.lang.String st, double[] vars)
           
static long s_parseLongExpression(java.lang.String st)
           
static long s_parseLongExpression(java.lang.String st, double[] vars)
           
static double s_parseMathExpression(java.lang.String st)
           
static double s_parseMathExpression(java.lang.String st, double[] vars)
           
static double s_pct(java.lang.String s)
           
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 int setb(int num, int bitmask)
           
static long setb(long num, int bitmask)
           
static long setb(long num, long bitmask)
           
 double sqrt(double d)
           
 float sqrt(float d)
           
static int squared(int x)
           
static java.lang.String toPct(double d)
           
static java.lang.String toPct(java.lang.String s)
           
static int unsetb(int num, int bitmask)
           
static long unsetb(long num, int bitmask)
           
static long unsetb(long num, long bitmask)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static CMath instance()

convertToRoman

public static java.lang.String convertToRoman(int i)
Convert an integer to its Roman Numeral equivalent Usage: Return=MiscFunc.convertToRoman(Number)+".";

Parameters:
i - Integer to convert
Returns:
String Converted integer

convertFromRoman

public static int convertFromRoman(java.lang.String s)
Convert an integer to its Roman Numeral equivalent Usage: Return=MiscFunc.convertToRoman(Number)+".";

Parameters:
s - String to convert
Returns:
String Converted integer

numAppendage

public static java.lang.String numAppendage(int num)

isRomanDigit

public static boolean isRomanDigit(char c)

isRomanNumeral

public static boolean isRomanNumeral(java.lang.String s)

absDiff

public static long absDiff(long x,
                           long y)

isNumber

public static boolean isNumber(java.lang.String s)

div

public static double div(double a,
                         double b)

div

public static double div(double a,
                         int b)

div

public static double div(int a,
                         double b)

div

public static double div(double a,
                         long b)

div

public static double div(long a,
                         double b)

mul

public static double mul(double a,
                         double b)

mul

public static double mul(double a,
                         int b)

mul

public static double mul(int a,
                         double b)

mul

public static double mul(double a,
                         long b)

mul

public static double mul(long a,
                         double b)

mul

public static long mul(long a,
                       long b)

mul

public static int mul(int a,
                      int b)

div

public static double div(long a,
                         long b)

div

public static double div(int a,
                         int b)

pow

public static long pow(long x,
                       long y)

squared

public static int squared(int x)

bset

public static boolean bset(short num,
                           short bitmask)

bset

public static boolean bset(int num,
                           int bitmask)

bset

public static boolean bset(long num,
                           long bitmask)

bset

public static boolean bset(long num,
                           int bitmask)

setb

public static int setb(int num,
                       int bitmask)

banyset

public static boolean banyset(int num,
                              int bitmask)

banyset

public static boolean banyset(long num,
                              long bitmask)

banyset

public static boolean banyset(long num,
                              int bitmask)

setb

public static long setb(long num,
                        int bitmask)

setb

public static long setb(long num,
                        long bitmask)

unsetb

public static int unsetb(int num,
                         int bitmask)

unsetb

public static long unsetb(long num,
                          long bitmask)

unsetb

public static long unsetb(long num,
                          int bitmask)

isSet

public static boolean isSet(int number,
                            int bitnumber)

isPct

public static boolean isPct(java.lang.String s)

s_pct

public static double s_pct(java.lang.String s)

toPct

public static java.lang.String toPct(double d)

toPct

public static java.lang.String toPct(java.lang.String s)

isSet

public static boolean isSet(long number,
                            int bitnumber)

isMathExpression

public static boolean isMathExpression(java.lang.String st)

isMathExpression

public static boolean isMathExpression(java.lang.String st,
                                       double[] vars)

s_parseMathExpression

public static double s_parseMathExpression(java.lang.String st)

s_parseMathExpression

public static double s_parseMathExpression(java.lang.String st,
                                           double[] vars)

s_parseLongExpression

public static long s_parseLongExpression(java.lang.String st)

s_parseLongExpression

public static long s_parseLongExpression(java.lang.String st,
                                         double[] vars)

s_parseIntExpression

public static int s_parseIntExpression(java.lang.String st)

s_parseIntExpression

public static int s_parseIntExpression(java.lang.String st,
                                       double[] vars)

parseLongExpression

public static long parseLongExpression(java.lang.String formula)

parseLongExpression

public static long parseLongExpression(java.lang.String formula,
                                       double[] vars)

parseIntExpression

public static int parseIntExpression(java.lang.String formula)
                              throws java.lang.ArithmeticException
Throws:
java.lang.ArithmeticException

parseIntExpression

public static int parseIntExpression(java.lang.String formula,
                                     double[] vars)
                              throws java.lang.ArithmeticException
Throws:
java.lang.ArithmeticException

parseMathExpression

public static double parseMathExpression(java.lang.String formula)
                                  throws java.lang.ArithmeticException
Throws:
java.lang.ArithmeticException

parseMathExpression

public static double parseMathExpression(java.lang.String formula,
                                         double[] vars)
                                  throws java.lang.ArithmeticException
Throws:
java.lang.ArithmeticException

s_long

public 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"));

Parameters:
LONG - String to convert
Returns:
long Long value of the string

s_float

public 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"));

Parameters:
FLOAT - String to convert
Returns:
Float value of the string

s_double

public 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"));

Parameters:
DOUBLE - String to convert
Returns:
double Double value of the string

abs

public static int abs(int val)

abs

public static long abs(long val)

s_bool

public 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));

Parameters:
BOOL - Boolean value of string
Returns:
int Boolean value of the string

isBool

public static boolean isBool(java.lang.String BOOL)
Returns whether the given string is a boolean value

Usage: if(isBool(CMD.substring(14)));

Parameters:
BOOL - Boolean value of string
Returns:
whether it is a boolean

s_int

public 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));

Parameters:
INT - Integer value of string
Returns:
int Integer value of the string

s_short

public 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));

Parameters:
SHORT - Short value of string
Returns:
short Short value of the string

isLong

public static boolean isLong(java.lang.String LONG)
Returns whether the given string is a long value

Usage: if(isLong(CMD.substring(14)));

Parameters:
LONG - Long value of string
Returns:
whether it is a long

isInteger

public static boolean isInteger(java.lang.String INT)
Returns whether the given string is a int value

Usage: if(isInteger(CMD.substring(14)));

Parameters:
INT - Integer value of string
Returns:
whether it is a int

isFloat

public static boolean isFloat(java.lang.String DBL)
Returns whether the given string is a float value

Usage: if(isFloat(CMD.substring(14)));

Parameters:
DBL - float value of string
Returns:
whether it is a float

isDouble

public static boolean isDouble(java.lang.String DBL)
Returns whether the given string is a double value

Usage: if(isDouble(CMD.substring(14)));

Parameters:
DBL - double value of string
Returns:
whether it is a double

round

public long round(double d)

round

public long round(float d)

abs

public double abs(double d)

abs

public float abs(float d)

random

public double random()

floor

public double floor(double d)

floor

public float floor(float d)

ceiling

public double ceiling(double d)

ceiling

public float ceiling(float d)

sqrt

public double sqrt(double d)

sqrt

public float sqrt(float d)