|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.primordion.xholon.util.Misc
This is a mix of static methods that don't have a home elsewhere. The methods all have to do with random numbers, and conversion between ASCII and various numeric formats.
| Field Summary | |
static int |
JAVACLASS_array
|
static int |
JAVACLASS_arrayboolean
|
static int |
JAVACLASS_arraydouble
|
static int |
JAVACLASS_arrayfloat
|
static int |
JAVACLASS_arrayint
|
static int |
JAVACLASS_arrayString
|
static int |
JAVACLASS_boolean
|
static int |
JAVACLASS_double
|
static int |
JAVACLASS_float
|
static int |
JAVACLASS_int
|
static int |
JAVACLASS_long
|
static int |
JAVACLASS_String
|
static int |
JAVACLASS_UNKNOWN
|
| Constructor Summary | |
Misc()
|
|
| Method Summary | |
static boolean |
atob(java.lang.String str,
int ixStart)
Convert an ascii string into a boolean. |
static double |
atod(java.lang.String str,
int ixStart)
Convert an ascii string into a double. |
static float |
atof(java.lang.String str,
int ixStart)
Convert an ascii string into a float. |
static int |
atoi(java.lang.String str,
int ixStart)
Convert an ascii string into an int. |
static long |
atol(java.lang.String str,
int ixStart)
Convert an ascii string into a long. |
static boolean |
booleanValue(java.lang.String b)
Return the boolean equivalent of a String. |
static boolean |
canExecute(java.io.File f)
Can this existing file be executed? A similar function has been added to Java 6. |
static void |
closeInputFile(java.io.Reader in)
Close input file. |
static void |
closeOutputFile(java.io.Writer out)
Close output file. |
static int |
getJavaDataType(java.lang.String s)
Get the Java type of the input data. |
static int |
getNumericValue(char ch)
Get the numeric value of a char. |
static java.util.Random |
getRandom()
Get the singleton instance of Random used by this application. |
static double |
getRandomDouble(double minVal,
double maxVal)
Get random double >= minVal and <= maxVal. |
static int |
getRandomInt(int minVal,
int maxVal)
Get random integer >= minVal and < maxVal. |
static boolean |
isdigit(int digit)
Is this a digit, a value between 0 and 9. |
static boolean |
isEven(int val)
Is this an even number? |
static boolean |
isMathSymbol(char symbol)
Is this a math symbol? This method takes the place of calling if (Character.getType(symbol) == Character.MATH_SYMBOL) |
static java.io.Reader |
openInputFile(java.lang.String fileName)
Open input file. |
static java.io.Writer |
openOutputFile(java.lang.String fileName)
Open output file. |
static long |
seedRandomNumberGenerator()
Seed the random number generator with the current data and time. |
static long |
seedRandomNumberGenerator(long seed)
Seed the random number generator with a known value. |
static boolean |
setExecutable(java.io.File f,
boolean executable)
Set the executable attribute of an existing file. |
static boolean |
setExecutable(java.io.File f,
boolean executable,
boolean ownerOnly)
Set the executable attribute of an existing file. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int JAVACLASS_UNKNOWN
public static final int JAVACLASS_int
public static final int JAVACLASS_long
public static final int JAVACLASS_double
public static final int JAVACLASS_float
public static final int JAVACLASS_boolean
public static final int JAVACLASS_String
public static final int JAVACLASS_array
public static final int JAVACLASS_arrayint
public static final int JAVACLASS_arraydouble
public static final int JAVACLASS_arrayfloat
public static final int JAVACLASS_arrayboolean
public static final int JAVACLASS_arrayString
| Constructor Detail |
public Misc()
| Method Detail |
public static java.util.Random getRandom()
public static double atod(java.lang.String str,
int ixStart)
str - The string that contains the double.ixStart - The start position within the string (0 indexed).
public static float atof(java.lang.String str,
int ixStart)
str - The string that contains the float.ixStart - The start position within the string (0 indexed).
public static int atoi(java.lang.String str,
int ixStart)
str - The string that contains the int.ixStart - The start position within the string (0 indexed).
public static long atol(java.lang.String str,
int ixStart)
str - The string that contains the long.ixStart - The start position within the string (0 indexed).
public static boolean atob(java.lang.String str,
int ixStart)
str - The string that contains the boolean.ixStart - The start position within the string (0 indexed).
public static boolean isdigit(int digit)
digit - The digit being tested.
public static boolean isMathSymbol(char symbol)
symbol - A character to be tested to see if it's a math symbol.
public static boolean isEven(int val)
val - An integer that may be even or odd.
public static int getNumericValue(char ch)
ch - A character.
public static boolean booleanValue(java.lang.String b)
b - A String that must have a value of "true", "false", "TRUE", or "FALSE".
public static int getJavaDataType(java.lang.String s)
s - Some data.
public static int getRandomInt(int minVal,
int maxVal)
minVal - The result will be >= this value.maxVal - The result will be < this value.
public static double getRandomDouble(double minVal,
double maxVal)
minVal - The result will be >= this value.maxVal - The result will be <= this value.
public static long seedRandomNumberGenerator()
public static long seedRandomNumberGenerator(long seed)
public static java.io.Reader openInputFile(java.lang.String fileName)
fileName - Name of input file.
public static void closeInputFile(java.io.Reader in)
in - An instance of Reader.public static java.io.Writer openOutputFile(java.lang.String fileName)
fileName - Name of the output file.
public static void closeOutputFile(java.io.Writer out)
out - An instance of Writer.
public static boolean setExecutable(java.io.File f,
boolean executable)
f - An existing file.executable - If true, sets the access permission to allow execute operations;
if false to disallow execute operations.
public static boolean setExecutable(java.io.File f,
boolean executable,
boolean ownerOnly)
f - An existing file.executable - If true, sets the access permission to allow execute operations;
if false to disallow execute operations.ownerOnly - If true, the execute permission applies only to the owner's execute permission;
otherwise, it applies to everybody. If the underlying file system can not distinguish the
owner's execute permission from that of others, then the permission will apply to everybody,
regardless of this value.
public static boolean canExecute(java.io.File f)
f - An existing file.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||