Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## vis.util
Class Util

    java.lang.Object
      |
      +--vis.util.Util

public class Util
extends java.lang.Object

The Util class has a number of utility methods that are used in different beans.

Version:
  2.0 July 24 2000
Author:
  Larry Rodrigues

Constructor Summary
`Util()`

Method Summary
`static int[]` | `colorToIntensity(int[] pixValue)` Converts RGB color values to its corresponding intensity values.
`static void` | `computeHistogram(double[] data, int maxbars, int[] binCount, double[] xMinmax, int[] yMinmax)` Computes histogram.
`static void` | `computeHistogram(int[] data, int maxbars, int[] binCount, int[] xMinmax, int[] yMinmax)` Computes histogram.
`static HistoData` | `computeHistogram(java.lang.Object dataObj, int maxbars)` Computes histogram.
`static double[][]` | `convertToDouble(java.lang.Object obj)` Converts a 2 dimensional array of any type to a 2 dimensional array of of double.
`static java.lang.String[][]` | `convertToString(java.lang.Object obj)` Converts a 2 dimensional array object of any type to a 2 dimensional string array.
`static int[]` | `getArrayDimension(java.lang.Object obj)` Gets the dimesions of a generic 2 dimensional array.
`static int[]` | `getDegrees(java.lang.Object obj)` Converts an input array into an array of angles.
`static int` | `getDiff(java.lang.Object obj, java.lang.Object minmax, int index, double scale)` Computes the difference between the value at a given index of the input array and the minimum value, i.e.; diff = (inp[index] - min)*scale.
`static java.lang.String` | `getInBetString(java.lang.Object obj, double val)` Computes the absolute inbetween value and returns it as a string.
`static int` | `getLength(java.lang.Object obj)` Gets the size of a generic array.
`static double[]` | `getMinMax(double[] inp)` Computes minimun and maximum of the values in an array.
`static int[]` | `getMinMax(int[] inp)` Computes minimun and maximum of the values in a given array.
`static long[]` | `getMinMax(long[] inp)` Computes minimum and maximum values of an array.
`static java.lang.Object` | `getMinMax(java.lang.Object inp)` Computes minimun and maximum values of an array.
`static java.lang.Object` | `getMinMax(java.lang.Object[] inparray)`
`static java.lang.Object` | `getMinMax(java.lang.Object inp, int percentage)` Computes minimun and maximum values of an array.
`static short[]` | `getMinMax(short[] inp)` Computes minimum and maximum values of an array.
`static double` | `getRange(java.lang.Object obj)` Computes the range (maximum - minimum) from a minmax array which can be generic.
`static java.lang.String` | `maxString(java.lang.Object obj)` Returns the maximum value as a string from a minmax array.
`static java.lang.String[]` | `toString(java.lang.Object obj)` Converts an one dimensional array of numbers into an array of corresponding string values.
`static double` | `trunc(double db)` Truncates a double value to the 2nd decimal precison.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Util

    public Util()

Method Detail

### computeHistogram

    public static HistoData computeHistogram(java.lang.Object dataObj,
                                             int maxbars)

  Computes histogram.
  Parameters:
    `data` - the input data array whose elements can be of any Java primitive types.
    `maxbars` - the maximum number of bars in the histogram.

### computeHistogram

    public static void computeHistogram(int[] data,
                                        int maxbars,
                                        int[] binCount,
                                        int[] xMinmax,
                                        int[] yMinmax)

  Computes histogram.
  Parameters:
    `data` - the input data array.
    `maxbars` - the maximum number of bars in the histogram.
    `binCount` - the array of frequency count.
    `xMinMax` - an array of size 2 which holds minimum and maximum of X axis values.
    `yMinMax` - an array of size 2 which holds minimum and maximum of Y values.

### getMinMax

    public static java.lang.Object getMinMax(java.lang.Object inp,
                                             int percentage)

  Computes minimun and maximum values of an array.
  Parameters:
    `inp` - the input array as an Object.
  Returns:
    the minmax array as an object. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### getMinMax

    public static java.lang.Object getMinMax(java.lang.Object inp)

  Computes minimun and maximum values of an array.
  Parameters:
    `inp` - the input array as an Object.
  Returns:
    the minmax array as an Object. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### getMinMax

    public static java.lang.Object getMinMax(java.lang.Object[] inparray)

### computeHistogram

    public static void computeHistogram(double[] data,
                                        int maxbars,
                                        int[] binCount,
                                        double[] xMinmax,
                                        int[] yMinmax)

  Computes histogram.
  Parameters:
    `data` - the input data array as an Object.
    `maxbars` - the maximum number of bars.
    `binCount` - an array of bin count.
    `xMinmax` - an array of size 2 which holds the minimum and maximum of X axis values.
    `yMinmax` - an array of size 2 which holds the minimum and maximum of Y axis values.

### getMinMax

    public static int[] getMinMax(int[] inp)

  Computes minimun and maximum of the values in a given array.
  Parameters:
    `inp` - the input array.
  Returns:
    the minmax array. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### getMinMax

    public static double[] getMinMax(double[] inp)

  Computes minimun and maximum of the values in an array.
  Parameters:
    `inp` - the input array.
  Returns:
    the minmax array. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### getMinMax

    public static short[] getMinMax(short[] inp)

  Computes minimum and maximum values of an array.
  Parameters:
    `inp` - a one dimensional array.
  Returns:
    the minmax array. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### getMinMax

    public static long[] getMinMax(long[] inp)

  Computes minimum and maximum values of an array.
  Parameters:
    `inp` - a one dimensional array.
  Returns:
    the minmax array. minmax[0] holds the minimum value and minmax[1] holds the maximum value.

### colorToIntensity

    public static int[] colorToIntensity(int[] pixValue)

  Converts RGB color values to its corresponding intensity values.
  Parameters:
    `pixValue` - an array of color pixel values.
  Returns:
    an array of intensity values.

### toString

    public static java.lang.String[] toString(java.lang.Object obj)

  Converts an one dimensional array of numbers into an array of corresponding string values.
  Parameters:
    `obj` - an array of Java primitive type as an Object.
  Returns:
    an array of strings.

### maxString

    public static java.lang.String maxString(java.lang.Object obj)

  Returns the maximum value as a string from a minmax array.
  Parameters:
    `obj` - an array of size 2 representing the min and mx values.
  Returns:
    the maximum value as a string.

### getInBetString

    public static java.lang.String getInBetString(java.lang.Object obj,
                                                  double val)

  Computes the absolute inbetween value and returns it as a string.
  Parameters:
    `obj` - the minmax array i.e.; an array of size 2 in which minmax[0] is the maximum value and minmax[1] as the minimum value.
    `val` - the inbetween value relative to the minimum value.
  Returns:
    the absolute inbetween value as a string.

### getRange

    public static double getRange(java.lang.Object obj)

  Computes the range (maximum - minimum) from a minmax array which can be generic.
  Parameters:
    `obj` - a one dimensional array of size 2 of Java primitive types as an Object.
  Returns:
    the range as a double value.

### trunc

    public static double trunc(double db)

  Truncates a double value to the 2nd decimal precison.
  Parameters:
    `db` - the double value.
  Returns:
    the truncated double value.

### getLength

    public static int getLength(java.lang.Object obj)

  Gets the size of a generic array.
  Parameters:
    `obj` - an array of Java primitive types.
  Returns:
    the length of the array.

### getArrayDimension

    public static int[] getArrayDimension(java.lang.Object obj)

  Gets the dimesions of a generic 2 dimensional array.
  Parameters:
    `obj` - the input array which can be of any primitive type.
  Returns:
    an array representing the input array dimensions.

### convertToDouble

    public static double[][] convertToDouble(java.lang.Object obj)

  Converts a 2 dimensional array of any type to a 2 dimensional array of of double.
  Parameters:
    `obj` - a 2 dimensional array as an Object.
  Returns:
    a 2 dimensional array of double.

### convertToString

    public static java.lang.String[][] convertToString(java.lang.Object obj)

  Converts a 2 dimensional array object of any type to a 2 dimensional string array.
  Parameters:
    `obj` - a 2 dimensional array as an Object.
  Returns:
    a 2 dimensional array of strings.

### getDiff

    public static int getDiff(java.lang.Object obj,
                              java.lang.Object minmax,
                              int index,
                              double scale)

  Computes the difference between the value at a given index of the input array and the minimum value, i.e.; diff = (inp[index] - min)*scale. This difference returned is a scaled value. This method is useful in plotting applications in which there is a need to compute the actual distance at every tick from the origin.
  Parameters:
    `obj` - a one dimensional array of any primitive data type.
    `minmax` - an array of size 2 that represents the minimum and maximum values.
    `index` - the index in the input array.
    `scale` - the scaling factor.
  Returns:
    the scaled difference from the minimum value.

### getDegrees

    public static int[] getDegrees(java.lang.Object obj)

  Converts an input array into an array of angles. This is used in for computing pie angles in pie charts.
  Parameters:
    `obj` - a one dimensional array of Java primitive data types.
  Returns:
    an array of angles.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD