|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.brook.ascape.util.Utility
An class encapsulating various common utility functions. For now, just has some random number helper functions and a set of series for 2D arrays.
| Field Summary | |
static int[][][] |
uniqueSeries
A quick set of unique series up to 4 nodes. |
| Constructor Summary | |
Utility()
|
|
| Method Summary | |
static java.lang.String |
formatElapsedMillis(long time)
Formats a time in milleseconds (typically elapsed time) into a string with format "[d'd'] hh:mm:ss.mmmm". |
static java.lang.String |
formatToString(double num,
int decPlaces)
Returns the supplied number formatted as a string with the given number of decimal places fixed. |
static java.lang.String |
getClassNameOnly(java.lang.Class c)
|
static void |
notImplemented()
Reports standard error and any other desired behavior when the user attempts to use an unimplemented method. |
static java.lang.String |
orderedQualifiers(java.lang.String string)
Removes qualifiers such as min and max from string, placing an appropriate order token at the end of the string. |
static java.lang.String |
padStringLeft(java.lang.String string,
int size)
Pads the string with spaces on the left to the supplied size. |
static java.lang.String |
padStringLeftWithZeros(java.lang.String string,
int size)
Pads the string with spaces on the left to the supplied size. |
static java.lang.String |
padStringRight(java.lang.String string,
int size)
Pads the string with spaces on the right to the supplied size. |
static int |
randomInRange(java.util.Random random,
int low,
int high)
Returns an integer distributed across some range as the supplied integer is uniformally distributed across the full range of integers. |
static boolean |
randomIs(java.util.Random random)
Returns a random boolean value. |
static int |
randomToLimit(java.util.Random random,
int limit)
Returns an integer distributed across 0...high - 1 as the supplied integer is distributed across the full range of integers. |
static java.lang.String |
removeQualifiers(java.lang.String string)
Removes qualifiers such as min and max from string. |
static boolean |
test()
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int[][][] uniqueSeries
| Constructor Detail |
public Utility()
| Method Detail |
public static final int randomInRange(java.util.Random random,
int low,
int high)
random - the random number stream to uselow - the lowest number (inclusive) that the resulting int might below - the hignest number (inclusive) that the resulting int might be
public static final int randomToLimit(java.util.Random random,
int limit)
random - the random number stream to uselimit - the maximum limit (exclusize) of the rusulting intpublic static final boolean randomIs(java.util.Random random)
random - the random number stream to usepublic static void notImplemented()
public static java.lang.String formatElapsedMillis(long time)
public static java.lang.String removeQualifiers(java.lang.String string)
string - the string to remove qualifiers frompublic static java.lang.String orderedQualifiers(java.lang.String string)
string - the string to remove qualifiers from
public static java.lang.String padStringRight(java.lang.String string,
int size)
string - the string to padsize - the size to pad (or truncate) the string to
public static java.lang.String padStringLeft(java.lang.String string,
int size)
string - the string to padsize - the size to pad (or truncate) the string to
public static java.lang.String padStringLeftWithZeros(java.lang.String string,
int size)
string - the string to padsize - the size to pad (or truncate) the string to
public static java.lang.String formatToString(double num,
int decPlaces)
formatToString(23.436765, 2) would return "23.44".
- Parameters:
num - the number to formatdecPlaces - the number of places to display
public static java.lang.String getClassNameOnly(java.lang.Class c)
public static boolean test()
|
(c) 1998-2000 The Brookings Insitution Webpage |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||