edu.indiana.util
Class Utility

java.lang.Object
  extended by edu.indiana.util.Utility

public abstract class Utility
extends java.lang.Object

Contains some useful standard static functions.


Nested Class Summary
static class Utility.CurrentStackTrace
           
 
Constructor Summary
Utility()
          Creates new Utility
 
Method Summary
static java.lang.String doubleArrayToString(double[] a)
          Convert an array of doubles to a String representation.
static void fatalError(java.lang.String msg)
          Signal a fatal error, and exit the program.
static int[] fillIntArray(int[] a, int from, int to, int startVal, int step)
          Including from, excluding to.
static java.lang.String getPartialStackHistory(int historySize)
           
static java.lang.String getPartialStackHistory(int historyStart, int historyStop)
           
static java.lang.String getStackTrace()
           
static double inputDouble()
          Input a double from the keyboard.
static java.lang.String inputString()
          Input a String from the keyboard.
static java.util.ArrayList intArrayToIntegerArrayList(int[] a)
          Convert an array of ints into a ArrayList of Integer objects.
static java.lang.String intArrayToString(int[] a)
          Convert an array of doubles to a String representation.
static double logBase(double value, double base)
          Calculate the log of a value to a given base
static java.lang.Object[] makeSubArray(java.lang.Object[] a, int from, int to)
          including from, excluding to
static java.util.ArrayList makeSubArrayList(java.util.ArrayList originalList, int from, int to)
          including from, excluding to
static double[] makeSubDoubleArray(double[] a, int from, int to)
          including from, excluding to
static int[] makeSubIntArray(int[] a, int from, int to)
          including from, excluding to
static java.lang.String objectArrayToString(java.lang.Object[] a)
          Convert an array of objects into a single String representation.
static void printStackTrace()
          Print the stack trace for the current execution position in the program.
static java.lang.String stringToHTMLLines(java.lang.String str, int lineWidth)
           
static void warning(java.lang.String msg)
          Signal a warning, and all the program to continue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

public Utility()
Creates new Utility

Method Detail

stringToHTMLLines

public static java.lang.String stringToHTMLLines(java.lang.String str,
                                                 int lineWidth)

logBase

public static double logBase(double value,
                             double base)
Calculate the log of a value to a given base

Parameters:
value - The value of which to take the log.
base - The base of the log.

fatalError

public static final void fatalError(java.lang.String msg)
Signal a fatal error, and exit the program.


warning

public static final void warning(java.lang.String msg)
Signal a warning, and all the program to continue.


printStackTrace

public static final void printStackTrace()
Print the stack trace for the current execution position in the program.


getStackTrace

public static final java.lang.String getStackTrace()

getPartialStackHistory

public static final java.lang.String getPartialStackHistory(int historySize)

getPartialStackHistory

public static final java.lang.String getPartialStackHistory(int historyStart,
                                                            int historyStop)

doubleArrayToString

public static final java.lang.String doubleArrayToString(double[] a)
Convert an array of doubles to a String representation.


intArrayToString

public static final java.lang.String intArrayToString(int[] a)
Convert an array of doubles to a String representation.


intArrayToIntegerArrayList

public static java.util.ArrayList intArrayToIntegerArrayList(int[] a)
Convert an array of ints into a ArrayList of Integer objects.


objectArrayToString

public static java.lang.String objectArrayToString(java.lang.Object[] a)
Convert an array of objects into a single String representation.


makeSubIntArray

public static int[] makeSubIntArray(int[] a,
                                    int from,
                                    int to)
including from, excluding to


makeSubDoubleArray

public static double[] makeSubDoubleArray(double[] a,
                                          int from,
                                          int to)
including from, excluding to


makeSubArray

public static java.lang.Object[] makeSubArray(java.lang.Object[] a,
                                              int from,
                                              int to)
including from, excluding to


makeSubArrayList

public static java.util.ArrayList makeSubArrayList(java.util.ArrayList originalList,
                                                   int from,
                                                   int to)
including from, excluding to


fillIntArray

public static int[] fillIntArray(int[] a,
                                 int from,
                                 int to,
                                 int startVal,
                                 int step)
Including from, excluding to. Values start at startVal, increase by step.

Parameters:
a - int[]
from - int
to - int
Returns:
int[]

inputString

public static java.lang.String inputString()
Input a String from the keyboard.


inputDouble

public static double inputDouble()
Input a double from the keyboard.