org.strbio.util
Class JMC

java.lang.Object
  extended by org.strbio.util.JMC

public final class JMC
extends java.lang.Object

A class containing a bunch of useful functions

Version:
1.5, 2/21/02
Author:
JMC

Method Summary
static void centerFrame(java.awt.Frame f)
          Center a frame on the screen.
static void drawLineDashed(java.awt.Graphics g, int ax, int ay, int bx, int by)
          draw a dashed line from point a to point b.
static void drawLineDashed(java.awt.Graphics g, int ax, int ay, int bx, int by, int segsize)
          draw a dashed line from point a to point b.
static void drawLineDotted(java.awt.Graphics g, int ax, int ay, int bx, int by)
          draw a dotted line from point a to point b.
static void drawLineHalfway(java.awt.Graphics g, int ax, int ay, int bx, int by)
          draw a line from point a halfway to point b.
static void fatal(java.lang.String s)
          Print a fatal error, attempt to flush System.out and System.err, and exit with status one.
static boolean isLittleEndian()
          This guesses whether the current machine is little-endian, and would therefore need to use the reverseEndian calls when reading/writing DataStreams for use with C programs.
static void oldCenterFrame(java.awt.Frame f)
          Center a frame on the screen.
static void oldRandomlyLocateFrame(java.awt.Frame f)
          Randomly locate a frame somewhere on the screen where it fits.
static void printArgs(java.lang.String[] argv)
          Print out the arguments used to call the program to the standard output stream.
static void printArgs(java.lang.String[] argv, Printf outfile)
          Print out the arguments used to call the program to a given Printf.
static void printTime(float seconds)
          Given a time in seconds, prints it in hours:minutes:seconds format to standard output.
static void printTime(float seconds, Printf outfile)
          Given a time in seconds, prints it in hours:minutes:seconds format.
static void programTimer()
          Program timer routine.
static void programTimer(Printf outfile)
          Program timer routine.
static void randomlyLocateFrame(java.awt.Frame f)
          Randomly locate a frame somewhere on the screen where it fits.
static double reverseEndian(double d)
          byte-reverse a double
static int reverseEndian(int i)
          byte-reverse an integer
static long reverseEndian(long l)
          byte-reverse a long
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fatal

public static final void fatal(java.lang.String s)
Print a fatal error, attempt to flush System.out and System.err, and exit with status one. You should throw an exception instead unless the error is really fatal.

Parameters:
s - Text explaining the error.

printArgs

public static final void printArgs(java.lang.String[] argv,
                                   Printf outfile)
                            throws java.io.IOException
Print out the arguments used to call the program to a given Printf. Output looks like:
      Arguments:
        arg1 arg2 arg3 ....


      

Parameters:
argv - The arguments that got passed to main.
outfile - File to output them to
Throws:
java.io.IOException

printArgs

public static final void printArgs(java.lang.String[] argv)
                            throws java.io.IOException
Print out the arguments used to call the program to the standard output stream.
      Arguments:
        arg1 arg2 arg3 ....


      

Parameters:
argv - The arguments that got passed to main.
Throws:
java.io.IOException

printTime

public static final void printTime(float seconds,
                                   Printf outfile)
                            throws java.io.IOException
Given a time in seconds, prints it in hours:minutes:seconds format.

Parameters:
seconds - number of seconds
outfile - where to print it to
Throws:
java.io.IOException

printTime

public static final void printTime(float seconds)
                            throws java.io.IOException
Given a time in seconds, prints it in hours:minutes:seconds format to standard output.

Parameters:
seconds - number of seconds
Throws:
java.io.IOException

programTimer

public static final void programTimer(Printf outfile)
                               throws java.io.IOException
Program timer routine. Call this at the beginning of your program, and it prints info about the host name and version of java, as well as remembering what time you called it at. Call this at the end of your program and it prints the elapsed time. It only prints wall time; there doesn't seem to be a way to get the CPU time from Java witout calling native methods. Every call flip-flops it from one function to the other.

Parameters:
outfile - where to print to
Throws:
java.io.IOException

programTimer

public static final void programTimer()
                               throws java.io.IOException
Program timer routine. Call this at the beginning of your program, and it prints info about the host name and version of java, as well as remembering what time you called it at. Call this at the end of your program and it prints the elapsed time. It only prints wall time; there doesn't seem to be a way to get the CPU time from Java witout calling native methods. This version just prints to standard output.

Throws:
java.io.IOException

randomlyLocateFrame

public static final void randomlyLocateFrame(java.awt.Frame f)
Randomly locate a frame somewhere on the screen where it fits. This should be called somewhere after pack().


centerFrame

public static final void centerFrame(java.awt.Frame f)
Center a frame on the screen. This can be called anywhere after pack().


oldRandomlyLocateFrame

public static final void oldRandomlyLocateFrame(java.awt.Frame f)
Randomly locate a frame somewhere on the screen where it fits. This should be called somewhere after pack().


oldCenterFrame

public static final void oldCenterFrame(java.awt.Frame f)
Center a frame on the screen. This can be called anywhere after pack().


drawLineDashed

public static final void drawLineDashed(java.awt.Graphics g,
                                        int ax,
                                        int ay,
                                        int bx,
                                        int by,
                                        int segsize)
draw a dashed line from point a to point b.


drawLineDashed

public static final void drawLineDashed(java.awt.Graphics g,
                                        int ax,
                                        int ay,
                                        int bx,
                                        int by)
draw a dashed line from point a to point b.


drawLineDotted

public static final void drawLineDotted(java.awt.Graphics g,
                                        int ax,
                                        int ay,
                                        int bx,
                                        int by)
draw a dotted line from point a to point b.


drawLineHalfway

public static final void drawLineHalfway(java.awt.Graphics g,
                                         int ax,
                                         int ay,
                                         int bx,
                                         int by)
draw a line from point a halfway to point b.


isLittleEndian

public static final boolean isLittleEndian()
This guesses whether the current machine is little-endian, and would therefore need to use the reverseEndian calls when reading/writing DataStreams for use with C programs.


reverseEndian

public static final int reverseEndian(int i)
byte-reverse an integer


reverseEndian

public static final long reverseEndian(long l)
byte-reverse a long


reverseEndian

public static final double reverseEndian(double d)
byte-reverse a double