public class Utilities
extends java.lang.Object
Collection of auxiliar methods.
Modifier and Type | Field and Description |
---|---|
static double |
log2
The natural logarithm of 2.
|
static double |
SMALL
The small deviation allowed in double comparisons
|
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
gr(double a,
double b)
Tests if a is greater than b.
|
static double |
log2(double a)
Returns the logarithm of a for base 2.
|
static void |
mergeSort(long[] theArray,
int nElems)
Mergesort algorithm for an array of long integers.
|
static void |
mergeSort(Pair[] theArray,
int nElems)
Mergesort algorithm for an array of Pairs.
|
static void |
mergeSort(Trio[] theArray,
int nElems)
Mergesort algorithm for a vector of Trio.
|
static boolean |
smOrEq(double a,
double b)
Tests if a is smaller or equal to b.
|
public static double SMALL
public static double log2
public static void mergeSort(long[] theArray, int nElems)
theArray
- long[] the Array to sortnElems
- int size of theArraypublic static void mergeSort(Pair[] theArray, int nElems)
theArray
- Pair[] the Array to sortnElems
- int size of theArraypublic static void mergeSort(Trio[] theArray, int nElems)
theArray
- Vector the Array to sortnElems
- int size of theArraypublic static boolean gr(double a, double b)
a
- a doubleb
- a doublepublic static boolean smOrEq(double a, double b)
a
- a doubleb
- a doublepublic static double log2(double a)
a
- a double