edu.iu.cnets.klatsch.misc
Class Utility

java.lang.Object
  extended by edu.iu.cnets.klatsch.misc.Utility

public class Utility
extends java.lang.Object

This class contains static utility functions that have no other logical place to go. Its existence is horribly un-object-y and all that, but so is java.lang.Math.


Field Summary
private static java.lang.String[] CONSONANT
           
private static java.lang.String[] PATTERN
           
static java.util.Random rnd
           
private static java.lang.String[] VOWEL
           
 
Constructor Summary
Utility()
           
 
Method Summary
static double[] joinDoubleArrays(double[] a, double[] b)
          Joins two arrays of doubles together into a new array.
static int[] joinIntArrays(int[] a, int[] b)
          Joins two arrays of ints together into a new array.
static java.lang.String listString(java.lang.Object[] array)
          Pretty-prints an array of objects so that they're separated by ", " substrings.
static java.lang.String randomName()
          Creates an artificial name for data generation.
static java.lang.String readFile(java.lang.String path)
          Reads the contents of an entire text file into a single string.
static java.lang.String sqlString(java.lang.String str)
          Prepares a String for use in a SQL query by escaping characters as necessary and adding single quotes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rnd

public static java.util.Random rnd

CONSONANT

private static final java.lang.String[] CONSONANT

VOWEL

private static final java.lang.String[] VOWEL

PATTERN

private static final java.lang.String[] PATTERN
Constructor Detail

Utility

public Utility()
Method Detail

joinDoubleArrays

public static double[] joinDoubleArrays(double[] a,
                                        double[] b)
Joins two arrays of doubles together into a new array.

Parameters:
a - the first array
b - the second array
Returns:
the joined array

joinIntArrays

public static int[] joinIntArrays(int[] a,
                                  int[] b)
Joins two arrays of ints together into a new array.

Parameters:
a - the first array
b - the second array
Returns:
the joined array

listString

public static java.lang.String listString(java.lang.Object[] array)
Pretty-prints an array of objects so that they're separated by ", " substrings.

Parameters:
array - the input array
Returns:
the array in string form

randomName

public static java.lang.String randomName()
Creates an artificial name for data generation.

Returns:
a new name

readFile

public static java.lang.String readFile(java.lang.String path)
Reads the contents of an entire text file into a single string.

Parameters:
path - the file to read
Returns:
the string read

sqlString

public static java.lang.String sqlString(java.lang.String str)
Prepares a String for use in a SQL query by escaping characters as necessary and adding single quotes.

Parameters:
str - the string to wrap
Returns:
the escaped string