public class Utilities
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.text.DecimalFormat |
fixedPoint
For numbers with four fraction digits.
|
static java.text.DecimalFormat |
scientific
For numbers in a power format.
|
| Constructor and Description |
|---|
Utilities() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.BitSet |
createBitSet(java.lang.String b)
Creates a BitSet from the given bit string.
|
static java.lang.String |
cutTailAtLast(java.lang.String terms,
char c)
Eliminates the substring after the last occurrence of 'c'
including 'c'.
|
static int |
express(java.util.BitSet gene,
int from,
int length)
Converts a bit gene in a positive integer value.
|
static double |
express(java.util.BitSet gene,
int from,
int length,
double low,
double high)
Converts a bit gene in a scaled double value.
|
static java.lang.String |
getClassName(java.lang.Object o)
Returns the unqualified class name, i.e., with all package names dropped.
|
static java.lang.String |
getFullClassName(java.lang.Object o)
Returns the qualified class name, i.e., with all package names.
|
static java.util.List |
getList()
Returns the utility list.
|
static java.lang.String |
getParentheses(int count)
Returns 'count' opening = '(' or closing = ')' parentheses.
|
static java.lang.Object |
instantiateByClassName(java.lang.String className,
java.lang.String[] constructorClassNames,
java.lang.Object[] constructorParameters)
Instantiates an Object by passing the name of the Class in a
String.
|
static int |
nextIntegerInRange(int low,
int high)
Return a random integer within 'low' and 'high'.
|
static double |
nextReal()
Return a random double within the unit interval'.
|
static double |
nextRealInRange(double low,
double high)
Return a random double within 'low' and 'high'.
|
static double |
normalNoise(double mu,
double sigma)
Normal noise with specified mean and standard deviation.
|
static void |
setRandomSeed(long seed)
Sets the random seed of the random number generator.
|
static void |
swap(java.util.List v,
int a,
int b)
Exchanges two elements in a List.
|
public static java.text.DecimalFormat fixedPoint
public static java.text.DecimalFormat scientific
public static final void setRandomSeed(long seed)
seed - the seedpublic static final int nextIntegerInRange(int low,
int high)
low - The lower bound.high - The higher bound.public static final double nextReal()
public static final double nextRealInRange(double low,
double high)
low - The lower bound.high - The higher bound.public static final double normalNoise(double mu,
double sigma)
mu - meansigma - standard deviationpublic static double express(java.util.BitSet gene,
int from,
int length,
double low,
double high)
gene - the bit genefrom - the first position to decodelength - the number of bits to decodelow - the lower bound of the value to be expressedhigh - the upper bound of the value to be expressedpublic static int express(java.util.BitSet gene,
int from,
int length)
gene - the bit genefrom - the first position to decodelength - the number of bits to decodepublic static java.util.BitSet createBitSet(java.lang.String b)
b - a bit stringpublic static void swap(java.util.List v,
int a,
int b)
v - the lista - first indexb - second idexpublic static java.lang.String getFullClassName(java.lang.Object o)
public static java.lang.String getClassName(java.lang.Object o)
public static java.lang.Object instantiateByClassName(java.lang.String className,
java.lang.String[] constructorClassNames,
java.lang.Object[] constructorParameters)
className - the name of the Class to instantiateconstructorClassNames - the names of the Classes of the parameters (may be null)constructorParameters - the actual parameters to the constructor (may be null)public static java.lang.String getParentheses(int count)
count - if positive opening else closingpublic static java.lang.String cutTailAtLast(java.lang.String terms,
char c)
terms - a Stringc - the delimiting characterpublic static java.util.List getList()