sources
Class Utils

java.lang.Object
  extended bysources.Utils

public class Utils
extends java.lang.Object

A class with static utility functions


Constructor Summary
Utils()
          Creates new Utils
 
Method Summary
static void arrangeDesktopCascade(javax.swing.JDesktopPane pane)
           
static void arrangeDesktopNext(javax.swing.JDesktopPane pane)
           
static void changeOrder(int oldpos, int newpos, int[] array)
           
static int[] createCatsAnzFeld(CategorialVariable[] vs)
          creates the catsAnzFeld, an array with the number of categories for each variable
static int[] createMosaic(CategorialVariable[] vs, int[] catsanzfeld)
          creates an int array of mosaics
static CategorialVariable createNewFromSelected(CategorialVariable catvar, Selectioner slect, int nid)
           
static ContinuousVariable createNewFromSelected(ContinuousVariable catvar, Selectioner slect, int nid)
           
static boolean iscont(java.lang.String c)
           
static boolean isDataSetFile(java.io.File f, java.lang.String[] str)
           
static boolean isImageFile(java.io.File f, java.lang.String[] str)
           
static boolean isMapFile(java.io.File f, java.lang.String[] str)
           
static boolean isord(java.lang.String c)
           
static boolean isPotentialPopupTrigger(java.awt.event.MouseEvent e)
           
static void main(java.lang.String[] args)
          test
static CategorialVariable makeCat(Variable var)
           
static ContinuousVariable makeCont(Variable var)
           
static java.awt.Polygon paintArrow(int x1, int y1, int x2, int y2, float thick)
          Paints an arrow
static java.awt.Polygon paintBar(int x1, int y1, int x2, int y2, float thick)
           
static java.awt.geom.GeneralPath paintCubicArrow(int x1, int y1, int xp1, int yp1, int xp2, int yp2, int x2, int y2, float thick)
           
static java.awt.geom.GeneralPath paintCurveArrow(int x1, int y1, int xp, int yp, int x2, int y2, float thick)
          paints a curve arrow
static void paintVertString(java.awt.Graphics g, int x, int y, java.lang.String s)
          paints a string vetically
static void quicksort1(int left, int right, int[] array, int[] listarray, boolean up)
          Quicksort Algorithm for int
static void quicksort2(int left, int right, double[] array, int[] listarray, boolean up)
          Quicksort Algorithm for double
static void quicksort3(int left, int right, java.lang.String[] array, int[] listarray, boolean up)
          Quicksort Algorithm for String
static double round(double val, double anzst)
          rounds a double
static void swap(int x, int y, int[] listarray)
          help function for quicksort
static java.lang.String truncTo(java.lang.String s, int n)
          truncs a String
static double trunctoafterComma(double s, int n)
          truncates a double value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Creates new Utils

Method Detail

round

public static double round(double val,
                           double anzst)
rounds a double

Parameters:
val - the double value
anzst - the #numbers to round
Returns:
the rounded value

truncTo

public static java.lang.String truncTo(java.lang.String s,
                                       int n)
truncs a String

Parameters:
s - the String to trunc
n - the number of characters to trunc to
Returns:
the truncated string

trunctoafterComma

public static double trunctoafterComma(double s,
                                       int n)
truncates a double value

Parameters:
s - the double value
n - the number of chars after comma
Returns:
the truncated double

quicksort1

public static void quicksort1(int left,
                              int right,
                              int[] array,
                              int[] listarray,
                              boolean up)
Quicksort Algorithm for int

Parameters:
left - left border
right - right border
array - the array to sort
listarray - the array that is sorted instead of the array
up - true: sort upwards false: sort downwards

quicksort2

public static void quicksort2(int left,
                              int right,
                              double[] array,
                              int[] listarray,
                              boolean up)
Quicksort Algorithm for double

Parameters:
left - left border
right - right border
array - the array to sort
listarray - the array that is sorted instead of the array
up - true: sort upwards false: sort downwards

quicksort3

public static void quicksort3(int left,
                              int right,
                              java.lang.String[] array,
                              int[] listarray,
                              boolean up)
Quicksort Algorithm for String

Parameters:
left - left border
right - right border
array - the array to sort
listarray - the array that is sorted instead of the array
up - true: sort upwards false: sort downwards

swap

public static void swap(int x,
                        int y,
                        int[] listarray)
help function for quicksort

Parameters:
x - first value to swap
y - 2nd value to swap
listarray - the array to swap

createMosaic

public static int[] createMosaic(CategorialVariable[] vs,
                                 int[] catsanzfeld)
creates an int array of mosaics

Parameters:
vs - the categorial Variables to build the mosaic of
catsanzfeld - the catsanzfeld, see createCatsAnzFeld(...)
Returns:
the mosaic

createCatsAnzFeld

public static int[] createCatsAnzFeld(CategorialVariable[] vs)
creates the catsAnzFeld, an array with the number of categories for each variable

Parameters:
vs - the araay of categorial variables
Returns:
the catsanzfeld

main

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

Parameters:
args - the args

paintVertString

public static void paintVertString(java.awt.Graphics g,
                                   int x,
                                   int y,
                                   java.lang.String s)
paints a string vetically

Parameters:
g - the Graphics to paint on
x - the x coordinate
y - the y coordinate
s - the String to draw

paintArrow

public static java.awt.Polygon paintArrow(int x1,
                                          int y1,
                                          int x2,
                                          int y2,
                                          float thick)
Paints an arrow

Parameters:
x1 - source x-coordinate
y1 - source y-coordinate
x2 - target x-coordinate
y2 - target y-coordinate
thick - the thickness of the arrow
Returns:
the arrow as polygon

paintBar

public static java.awt.Polygon paintBar(int x1,
                                        int y1,
                                        int x2,
                                        int y2,
                                        float thick)

paintCurveArrow

public static java.awt.geom.GeneralPath paintCurveArrow(int x1,
                                                        int y1,
                                                        int xp,
                                                        int yp,
                                                        int x2,
                                                        int y2,
                                                        float thick)
paints a curve arrow

Parameters:
x1 - start x coordinate
y1 - start y coordinate
xp - x coordinate of transfer point
yp - y coordinate of transfer point
x2 - end x coordinate
y2 - end y coordinate
thick - thickness of the arrow
Returns:

paintCubicArrow

public static java.awt.geom.GeneralPath paintCubicArrow(int x1,
                                                        int y1,
                                                        int xp1,
                                                        int yp1,
                                                        int xp2,
                                                        int yp2,
                                                        int x2,
                                                        int y2,
                                                        float thick)
Parameters:
x1 -
y1 -
xp1 -
yp1 -
xp2 -
yp2 -
x2 -
y2 -
thick -
Returns:

createNewFromSelected

public static CategorialVariable createNewFromSelected(CategorialVariable catvar,
                                                       Selectioner slect,
                                                       int nid)

createNewFromSelected

public static ContinuousVariable createNewFromSelected(ContinuousVariable catvar,
                                                       Selectioner slect,
                                                       int nid)

isPotentialPopupTrigger

public static boolean isPotentialPopupTrigger(java.awt.event.MouseEvent e)

iscont

public static boolean iscont(java.lang.String c)

isord

public static boolean isord(java.lang.String c)

makeCat

public static CategorialVariable makeCat(Variable var)

makeCont

public static ContinuousVariable makeCont(Variable var)

arrangeDesktopNext

public static void arrangeDesktopNext(javax.swing.JDesktopPane pane)

arrangeDesktopCascade

public static void arrangeDesktopCascade(javax.swing.JDesktopPane pane)

changeOrder

public static void changeOrder(int oldpos,
                               int newpos,
                               int[] array)

isImageFile

public static boolean isImageFile(java.io.File f,
                                  java.lang.String[] str)

isDataSetFile

public static boolean isDataSetFile(java.io.File f,
                                    java.lang.String[] str)

isMapFile

public static boolean isMapFile(java.io.File f,
                                java.lang.String[] str)