|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlbg.common.math.CommonMath
public abstract class CommonMath
Constructor Summary | |
---|---|
CommonMath()
|
Method Summary | |
---|---|
static java.lang.String |
div_label_2dd(double a)
|
static java.lang.String |
div_label_2dd(double a,
double b)
|
static java.lang.String |
div_label_2dd(double a,
double b,
double factor)
|
static java.lang.String |
div_label_2dd(long a)
|
static java.lang.String |
div_label_2dd(long a,
long b)
|
static java.lang.String |
div_label_2dd(long a,
long b,
double factor)
|
static java.lang.String |
div_label(double a)
|
static java.lang.String |
div_label(double a,
double b)
|
static java.lang.String |
div_label(double a,
double b,
double factor)
|
static java.lang.String |
div_label(long a)
|
static java.lang.String |
div_label(long a,
long b)
|
static java.lang.String |
div_label(long a,
long b,
double factor)
|
static double |
filterToZeroIfNaN(double d)
Filters target double-precision floating point number to zero if its value is not a number, else leaves it unchanged. |
static int |
generateHashCode(int target)
Returns a hash code for given number. |
static int |
generateHashCode(int target_principal,
int target_secondary)
Returns a hash code for given pair of numbers. |
static int |
generateHashCode(long target)
Returns a hash code for given number. |
static int |
generateHashCode(java.lang.String target)
Returns a hash code for given String. |
static double |
mean(double x1,
double x2)
Computes the mean of the two taget values. |
static double |
normalizeCheckedValue(double base_val,
double max_val)
Normalizes target base value with respect to target maximum value. |
static double |
normalizeValue(double base_val,
double max_val)
Normalizes target base value with respect to target maximum value. |
static boolean |
sampleRandomBoolean()
Returns a random boolean. |
static int |
sampleRandomFileSize(java.lang.String filename)
Samples a random file size sampled from a random distribution for target filename. |
static int |
sampleUniformDist()
Samples a uniform distribution. |
static int |
sampleUniformDist(int lo,
int hi)
Samples a uniform distribution. |
static long |
sampleUniformDist(long lo,
long hi)
Samples a uniform distribution. |
static float |
sampleUniformDistWithinUnity()
Samples a uniform distribution. |
static void |
setSeed(long seed)
|
static double |
stddev(double sum_x,
double sum_squared_x,
long N)
Deprecated. |
static double |
uncheckedStddev(double sum_x,
double sum_squared_x,
long N)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommonMath()
Method Detail |
---|
public static int sampleUniformDist(int lo, int hi) throws GridException
lo
- low boundaryhi
- high boundary
GridException
public static long sampleUniformDist(long lo, long hi) throws GridException
lo
- low boundaryhi
- high boundary
GridException
public static int sampleUniformDist() throws GridException
GridException
public static float sampleUniformDistWithinUnity() throws GridException
GridException
public static int sampleRandomFileSize(java.lang.String filename) throws GridException
Returned values are guaranteed to be in the interval [2 << 10..2 << 22 + 2 << 10]
Different calls with the same target filename are guaranteed to result in the same file size.
filename
- targer filename
GridException
- if target filename is illegalpublic static boolean sampleRandomBoolean()
public static java.lang.String div_label(long a)
public static java.lang.String div_label(long a, long b)
public static java.lang.String div_label(double a)
public static java.lang.String div_label(double a, double b)
public static java.lang.String div_label(long a, long b, double factor)
public static java.lang.String div_label(double a, double b, double factor)
public static java.lang.String div_label_2dd(long a)
public static java.lang.String div_label_2dd(long a, long b)
public static java.lang.String div_label_2dd(long a, long b, double factor)
public static java.lang.String div_label_2dd(double a)
public static java.lang.String div_label_2dd(double a, double b)
public static java.lang.String div_label_2dd(double a, double b, double factor)
public static double mean(double x1, double x2)
@Deprecated public static double stddev(double sum_x, double sum_squared_x, long N) throws GridException
sum_x
- sum of the observationssum_squared_x
- sum of the squared observationsN
- number of observations
GridException
- if a parameter is illegal@Deprecated public static double uncheckedStddev(double sum_x, double sum_squared_x, long N)
Note that this implementation does not throw an Exception, but instead returns a conventional, illegal value.
sum_x
- sum of the observationssum_squared_x
- sum of the squared observationsN
- number of observations
public static final double filterToZeroIfNaN(double d)
d
- target double-precision floating point number
public static double normalizeValue(double base_val, double max_val) throws GridException
Note: target base value greater than target maximum value are considered equal to target maximum value.
base_val
- target base valuemax_val
- target maximum value
GridException
- if a parameter is illegalpublic static double normalizeCheckedValue(double base_val, double max_val) throws GridException
base_val
- target base valuemax_val
- target maximum value
GridException
- if target base value is greater
than target maximum value, or if a parameter is illegalpublic static int generateHashCode(int target)
The hash code is guaranteed to be different from Integer.MIN_VALUE, which can facilitate caching and lazy initilization of hash codes.
target
- target number
public static int generateHashCode(long target)
The hash code is guaranteed to be different from Integer.MIN_VALUE, which can facilitate caching and lazy initilization of hash codes.
target
- target number
public static int generateHashCode(java.lang.String target)
The hash code is guaranteed to be different from Integer.MIN_VALUE, which can facilitate caching and lazy initilization of hash codes.
target
- target String
public static int generateHashCode(int target_principal, int target_secondary)
The hash code is guaranteed to be different from Integer.MIN_VALUE, which can facilitate caching and lazy initilization of hash codes.
target_principal
- target numbertarget_secondary
- target number
public static void setSeed(long seed)
|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.