edu.cmu.cs.sb.core
Class Util

java.lang.Object
  extended by edu.cmu.cs.sb.core.Util

public class Util
extends java.lang.Object

Class of static utility functions and static variables


Field Summary
static javax.swing.JFileChooser theChooser
          Common chooser object, used across classes so will remember the path
 
Constructor Summary
Util()
           
 
Method Summary
static double correlation(double[] xvalues, double[] yvalues)
          Computes the correlation coefficient on the arrays xvalues and yvalues
static double correlation(double[] xvalues, double[] yvalues, int[] include)
          Computes correlation coefficient between xvalues and yvalues only for those that have non-zero includex and includey values Returns 0 if no values are agree on for all data
static double correlation(double[] xvalues, double[] yvalues, int[] includex, int[] includey)
          Computes correlation coefficient between xvalues and yvalues only for those that have non-zero includex and includey values Returns 0 if no values are agree on for all data
static javax.swing.ImageIcon createImageIcon(java.lang.String path)
          Returns an ImageIcon, or null if the path was invalid.
static double distortion(double[] xvalues, double[] yvalues, int[] include)
          Returns the sum of the squared difference of xvalues and yvalues for non-zero include index values
static java.lang.String doubleToSz(double dval)
          Converts double into a formatted string representation
static double euclidean(double[] xvalues, double[] yvalues, int[] include)
          Returns the euclidean distance between xvalues and yvalues for those include values that are non-zero.
static java.net.URL getImageURL(java.lang.String path)
          Returns an URL for the path, or null if the path was invalid.
static double getmedian(double[] vals, int nvalindex)
          Returns the median value in vals in indicies between 0 and nvalindex-1
static double removeUnits(java.lang.String szvalunits)
          Removes units after last digit Throws an IllegalArgumentException if no digits in szvalunits
static void renderDialog(javax.swing.JDialog thedialog, java.lang.String szMessage, int noffsetx, int noffsety)
          Calls renderDialog with Help in the title window for a dialog
static void renderDialog(javax.swing.JDialog thedialog, java.lang.String szMessage, int noffsetx, int noffsety, java.lang.String szTitle)
          Renders a dialog window with szMessage attached to thedialog at location (noffsetx,noffsety) with title szTtitle
static void renderDialog(javax.swing.JFrame theframe, java.lang.String szMessage)
          Calls renderDialog with an offset X value of 25 and an offset Y value of 10
static void renderDialog(javax.swing.JFrame theframe, java.lang.String szMessage, int noffsetx, int noffsety)
          Calls renderDialog with Help in the title window for a JFrame
static void renderDialog(javax.swing.JFrame theframe, java.lang.String szMessage, int noffsetx, int noffsety, java.lang.String szTitle)
          Renders a dialog window with szMessage attached to theframe at location (noffsetx,noffsety) with title szTtitle
static int romanToNumeric(java.lang.String roman)
          function coverts roman numeral strings to integers up to 89.
static java.lang.String stripLastExtension(java.lang.String szinput)
          Returns a string that has the last period and everything after it removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theChooser

public static javax.swing.JFileChooser theChooser
Common chooser object, used across classes so will remember the path

Constructor Detail

Util

public Util()
Method Detail

stripLastExtension

public static java.lang.String stripLastExtension(java.lang.String szinput)
Returns a string that has the last period and everything after it removed.


romanToNumeric

public static int romanToNumeric(java.lang.String roman)
function coverts roman numeral strings to integers up to 89. assumes the roman numerals are actually properly formed. Does not look for errors and in case an improper character shows up returns 0.


removeUnits

public static double removeUnits(java.lang.String szvalunits)
Removes units after last digit Throws an IllegalArgumentException if no digits in szvalunits


doubleToSz

public static java.lang.String doubleToSz(double dval)
Converts double into a formatted string representation


createImageIcon

public static javax.swing.ImageIcon createImageIcon(java.lang.String path)
Returns an ImageIcon, or null if the path was invalid.


getImageURL

public static java.net.URL getImageURL(java.lang.String path)
Returns an URL for the path, or null if the path was invalid.


renderDialog

public static void renderDialog(javax.swing.JDialog thedialog,
                                java.lang.String szMessage,
                                int noffsetx,
                                int noffsety)
Calls renderDialog with Help in the title window for a dialog


renderDialog

public static void renderDialog(javax.swing.JFrame theframe,
                                java.lang.String szMessage,
                                int noffsetx,
                                int noffsety)
Calls renderDialog with Help in the title window for a JFrame


renderDialog

public static void renderDialog(javax.swing.JDialog thedialog,
                                java.lang.String szMessage,
                                int noffsetx,
                                int noffsety,
                                java.lang.String szTitle)
Renders a dialog window with szMessage attached to thedialog at location (noffsetx,noffsety) with title szTtitle


renderDialog

public static void renderDialog(javax.swing.JFrame theframe,
                                java.lang.String szMessage)
Calls renderDialog with an offset X value of 25 and an offset Y value of 10


renderDialog

public static void renderDialog(javax.swing.JFrame theframe,
                                java.lang.String szMessage,
                                int noffsetx,
                                int noffsety,
                                java.lang.String szTitle)
Renders a dialog window with szMessage attached to theframe at location (noffsetx,noffsety) with title szTtitle


correlation

public static double correlation(double[] xvalues,
                                 double[] yvalues)
Computes the correlation coefficient on the arrays xvalues and yvalues


correlation

public static double correlation(double[] xvalues,
                                 double[] yvalues,
                                 int[] include)
Computes correlation coefficient between xvalues and yvalues only for those that have non-zero includex and includey values Returns 0 if no values are agree on for all data


correlation

public static double correlation(double[] xvalues,
                                 double[] yvalues,
                                 int[] includex,
                                 int[] includey)
Computes correlation coefficient between xvalues and yvalues only for those that have non-zero includex and includey values Returns 0 if no values are agree on for all data


euclidean

public static double euclidean(double[] xvalues,
                               double[] yvalues,
                               int[] include)
Returns the euclidean distance between xvalues and yvalues for those include values that are non-zero.


distortion

public static double distortion(double[] xvalues,
                                double[] yvalues,
                                int[] include)
Returns the sum of the squared difference of xvalues and yvalues for non-zero include index values


getmedian

public static double getmedian(double[] vals,
                               int nvalindex)
Returns the median value in vals in indicies between 0 and nvalindex-1