rvl.util
Class Utility

java.lang.Object
  |
  +--rvl.util.Utility
All Implemented Interfaces:
Closeable

public class Utility
extends java.lang.Object
implements Closeable


Constructor Summary
Utility()
           
 
Method Summary
 void close()
           
static void error(java.lang.String msg)
          Display a fatal error in a text window and bring up a dialog to close it.
static void error(java.lang.String msg, Closeable app)
          Display a fatal error message in a text window and bring up a dialog to close it.
static void error(java.lang.Throwable t)
          Display a fatal error in a text window and bring up a dialog to close it.
static void error(java.lang.Throwable t, Closeable app)
          Display a fatal exception and its stack trace; then shut down as in error(msg,app)
static void exit(int status)
          Replacement for System.exit(status).
static java.lang.String fixedFormat(double x, int decPlaces)
           
static java.lang.String[] fmtNice(double[] x)
          Find a string representation for a set of nice numbers (requires at least 2) This will return unreliable results if numbers are not nice, especially if the 1st 2 elements are equal
static java.lang.String format(double x, int digits)
           
static java.lang.String format(double x, int digits, boolean trim)
           
static java.lang.String format(java.lang.String s, int nChars)
           
static void main(java.lang.String[] argv)
           
static java.lang.String minFormat(double x, double margin)
           
static double NaN(java.lang.String msg)
          Displays the message and returns Double.NaN.
static double[] nice(double a, double b, int minTicks, boolean enclose)
          Return an array of nice numbers that contain the interval (a,b) (if enclose==true) or that fall within [a,b] (if enclose==false)
static int[] order(double[] x)
           
protected static void order(int[] ord, double[] x, int bot, int top)
           
static double[] parseDoubles(java.lang.String str)
          Return an array of double values parsed from a string Any invalid entries are returned as Double.NaN
static void qsort(double[] x)
          Quick-sort algorithm Sorts x[] in place
protected static void qsort(double[] x, int bot, int top)
          This does the real work of qsort(double x[]); it sorts a partition of x[] from x[bot] to x[top], making recursive calls as needed.
static int[] rank(double[] x)
           
static float[] rankTies(double[] x)
           
static void setGUIWarn(boolean option)
          Set whether to display warnings/errors graphically or on console
static double strtod(java.lang.String s)
           
static float strtof(java.lang.String s)
           
static int strtoi(java.lang.String s)
           
static long strtol(java.lang.String s)
           
static void warning(java.lang.String msg)
          Display a warning error in a text window
static void warning(java.lang.Throwable t)
           
static void warning(java.lang.Throwable t, boolean stackTrace)
          Display the message from a Throwable object in a text window the stack trace is also displayed if stackTrace is true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

public Utility()
Method Detail

strtod

public static double strtod(java.lang.String s)

strtof

public static float strtof(java.lang.String s)

strtoi

public static int strtoi(java.lang.String s)

strtol

public static long strtol(java.lang.String s)

exit

public static void exit(int status)
Replacement for System.exit(status). Does appropriate thing when running in a browser.

close

public void close()
Specified by:
close in interface Closeable

NaN

public static double NaN(java.lang.String msg)
Displays the message and returns Double.NaN. Useful as an error exit for math routines

warning

public static void warning(java.lang.String msg)
Display a warning error in a text window

warning

public static void warning(java.lang.Throwable t,
                           boolean stackTrace)
Display the message from a Throwable object in a text window the stack trace is also displayed if stackTrace is true

warning

public static void warning(java.lang.Throwable t)

error

public static void error(java.lang.String msg,
                         Closeable app)
Display a fatal error message in a text window and bring up a dialog to close it. If app is not null, its close() method is called. Also attempts to shut down the JVM

error

public static void error(java.lang.Throwable t,
                         Closeable app)
Display a fatal exception and its stack trace; then shut down as in error(msg,app)

error

public static void error(java.lang.String msg)
Display a fatal error in a text window and bring up a dialog to close it. Also attempts to shut down the JVM

error

public static void error(java.lang.Throwable t)
Display a fatal error in a text window and bring up a dialog to close it. Also attempts to shut down the JVM

setGUIWarn

public static void setGUIWarn(boolean option)
Set whether to display warnings/errors graphically or on console

parseDoubles

public static double[] parseDoubles(java.lang.String str)
Return an array of double values parsed from a string Any invalid entries are returned as Double.NaN

nice

public static double[] nice(double a,
                            double b,
                            int minTicks,
                            boolean enclose)
Return an array of nice numbers that contain the interval (a,b) (if enclose==true) or that fall within [a,b] (if enclose==false)

fmtNice

public static java.lang.String[] fmtNice(double[] x)
Find a string representation for a set of nice numbers (requires at least 2) This will return unreliable results if numbers are not nice, especially if the 1st 2 elements are equal

minFormat

public static java.lang.String minFormat(double x,
                                         double margin)

fixedFormat

public static java.lang.String fixedFormat(double x,
                                           int decPlaces)

format

public static java.lang.String format(double x,
                                      int digits)

format

public static java.lang.String format(double x,
                                      int digits,
                                      boolean trim)

format

public static java.lang.String format(java.lang.String s,
                                      int nChars)

qsort

public static void qsort(double[] x)
Quick-sort algorithm Sorts x[] in place

qsort

protected static void qsort(double[] x,
                            int bot,
                            int top)
This does the real work of qsort(double x[]); it sorts a partition of x[] from x[bot] to x[top], making recursive calls as needed.

order

public static int[] order(double[] x)

order

protected static void order(int[] ord,
                            double[] x,
                            int bot,
                            int top)

rank

public static int[] rank(double[] x)

rankTies

public static float[] rankTies(double[] x)

main

public static void main(java.lang.String[] argv)