Documentation of 'visad.util.Util' Java class
Util
visad.util

Class Util



  • public class Util
    extends java.lang.Object
    A hodge-podge of general utility methods.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Util() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void adjustComboBox(javax.swing.JComboBox combo)
      Limit the given combo box to one line in height.
      static void adjustTextField(javax.swing.JTextField field)
      Limit the given text field to one line in height.
      static boolean arraysEqual(java.lang.Object[] o1, java.lang.Object[] o2)
      Tests whether two arrays are component-wise equal.
      static boolean canDoHDF5()
      Test whether HDF-5 native code is present in this JVM.
      static boolean canDoImageJ()
      Test whether ImageJ is present in this JVM.
      static boolean canDoJAI()
      Test whether Java Advanced Imaging is present in this JVM.
      static boolean canDoJava3D()
      Test whether Java3D is present in this JVM.
      static boolean canDoJava3D(java.lang.String version)
      Check to see if the version of Java3D being used is compatible with the desired specification version.
      static boolean canDoJPEG()
      Test whether javax.imageio can write JPEGs.
      static boolean canDoPython()
      Test whether Jython is present in this JVM.
      static boolean canDoQuickTime()
      Test whether QuickTime for Java is present in this JVM.
      static void captureDisplay(DisplayImpl display, java.lang.String filename)
      Capture a DisplayImpl into a JPEG file
      static void captureDisplay(DisplayImpl display, java.lang.String filename, boolean sync)
      Capture a DisplayImpl into a JPEG file
      static void centerWindow(java.awt.Window window)
      Center the given window on the screen.
      static void centerWindow(java.awt.Window parent, java.awt.Window window)
      Center the given window within the specified parent window.
      static double[][] clone(double[][] input)
      do a deep clone
      static float[][] clone(float[][] input)
      do a deep clone
      static java.util.logging.Level configureLogging(int verbosity) 
      static java.util.logging.Level configureLogging(int verbosity, java.lang.String pkg)
      Configure basic logging for the visad package.
      static ConstantMap[] getColorMaps(java.awt.Color color)
      Create a ConstantMap array of colors for use with Display.addReference(DataReference, ConstantMap[])
      static java.lang.String getName(javax.media.j3d.SceneGraphObject obj)
      Gets the name of the given SceneGraphObject.
      static java.lang.String getStackTrace()
      Utility method to return the stack trace
      static java.lang.String getTimestamp()
      Return a string representation of the current date and time.
      static java.lang.String getVersionDate()
      Return a string representation of VisAD's build date and time.
      static javax.swing.JFileChooser getVisADFileChooser()
      Return a JFileChooser that recognizes supported VisAD file types.
      static void invoke(boolean wait, boolean printStackTraces, java.lang.Runnable r)
      Executes the given Runnable object with the Swing event handling thread.
      static void invoke(boolean wait, java.lang.Runnable r)
      Executes the given Runnable object with the Swing event handling thread.
      static boolean isApproximatelyEqual(double a, double b)
      Determine whether two numbers are roughly the same.
      static boolean isApproximatelyEqual(double a, double b, double epsilon)
      Determine whether two numbers are roughly the same.
      static boolean isApproximatelyEqual(float a, float b)
      Determine whether two numbers are roughly the same.
      static boolean isApproximatelyEqual(float a, float b, float epsilon)
      Determine whether two numbers are roughly the same.
      static void printArray(java.lang.String prefix, double[] array)
      Print out the values in a double array.
      static void printArray(java.lang.String prefix, java.lang.Object[] array)
      Create a string representation of the given array
      static void printJ3DProperties(javax.media.j3d.Canvas3D canvas)
      Print Java3D global and Canvas3D properties to System.err.
      static void printJ3DProperties(java.io.PrintStream str, javax.media.j3d.Canvas3D canvas)
      Print Java3D properties.
      static void printSceneGraph(javax.media.j3d.Node node) 
      static void setName(javax.media.j3d.SceneGraphObject obj, java.lang.String name)
      Sets the name of the given SceneGraphObject.
      static int tenBitToTwoByte(byte[] input, short[] output)
      Convert 10-bit data to 2-byte data
      static int unsignedByteToInt(byte b)
      Converts an (unsigned) byte to an unsigned int.
      static long unsignedByteToLong(byte b)
      Converts an (unsigned) byte to an unsigned long.
      static int unsignedShortToInt(short s)
      Converts an (unsigned) byte to an unsigned int.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • isApproximatelyEqual

        public static boolean isApproximatelyEqual(float a,
                                                   float b,
                                                   float epsilon)
        Determine whether two numbers are roughly the same.
        Parameters:
        a - First number
        b - Second number
        epsilon - Absolute amount by which they can differ.
        Returns:
        true if they're approximately equal.
      • isApproximatelyEqual

        public static boolean isApproximatelyEqual(float a,
                                                   float b)
        Determine whether two numbers are roughly the same.
        Parameters:
        a - First number
        b - Second number
        Returns:
        true if they're approximately equal.
      • isApproximatelyEqual

        public static boolean isApproximatelyEqual(double a,
                                                   double b,
                                                   double epsilon)
        Determine whether two numbers are roughly the same.
        Parameters:
        a - First number
        b - Second number
        epsilon - Absolute amount by which they can differ.
        Returns:
        true if they're approximately equal.
      • isApproximatelyEqual

        public static boolean isApproximatelyEqual(double a,
                                                   double b)
        Determine whether two numbers are roughly the same.
        Parameters:
        a - First number
        b - Second number
        Returns:
        true if they're approximately equal.
      • getVersionDate

        public static java.lang.String getVersionDate()
        Return a string representation of VisAD's build date and time.
        Returns:
        VisAD build date and time
      • printJ3DProperties

        public static void printJ3DProperties(java.io.PrintStream str,
                                              javax.media.j3d.Canvas3D canvas)
        Print Java3D properties.
        Parameters:
        str - Where to print properties.
        canvas - The Canvas3D to get properties from. If null Canvas3D properties are skipped.
        See Also:
        printJ3DProperties(Canvas3D)
      • printJ3DProperties

        public static void printJ3DProperties(javax.media.j3d.Canvas3D canvas)
        Print Java3D global and Canvas3D properties to System.err.
        Parameters:
        canvas - The Canvas3D to get properties from. If null Canvas3D properties are skipped.
        See Also:
        VirtualUniverse.getProperties(), Canvas3D.queryProperties()
      • printSceneGraph

        public static void printSceneGraph(javax.media.j3d.Node node)
        Parameters:
        node -
      • getName

        public static java.lang.String getName(javax.media.j3d.SceneGraphObject obj)
        Gets the name of the given SceneGraphObject. This method exists to avoid a compile-time dependency on Java3D 1.4+.
      • setName

        public static void setName(javax.media.j3d.SceneGraphObject obj,
                                   java.lang.String name)
        Sets the name of the given SceneGraphObject. This method exists to avoid a compile-time dependency on Java3D 1.4+.
      • tenBitToTwoByte

        public static int tenBitToTwoByte(byte[] input,
                                          short[] output)
        Convert 10-bit data to 2-byte data
        Parameters:
        input -
        output -
        Returns:
        0 if no errors
      • getTimestamp

        public static java.lang.String getTimestamp()
        Return a string representation of the current date and time.
        Returns:
        string timestamp for current time
      • getVisADFileChooser

        public static javax.swing.JFileChooser getVisADFileChooser()
        Return a JFileChooser that recognizes supported VisAD file types.
        Returns:
        file chooser which recognizes supported VisAD file types
      • adjustTextField

        public static void adjustTextField(javax.swing.JTextField field)
        Limit the given text field to one line in height.
        Parameters:
        field -
      • adjustComboBox

        public static void adjustComboBox(javax.swing.JComboBox combo)
        Limit the given combo box to one line in height.
        Parameters:
        combo -
      • centerWindow

        public static void centerWindow(java.awt.Window window)
        Center the given window on the screen.
        Parameters:
        window -
      • centerWindow

        public static void centerWindow(java.awt.Window parent,
                                        java.awt.Window window)
        Center the given window within the specified parent window.
        Parameters:
        parent -
        window -
      • canDoHDF5

        public static boolean canDoHDF5()
        Test whether HDF-5 native code is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoImageJ

        public static boolean canDoImageJ()
        Test whether ImageJ is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoJPEG

        public static boolean canDoJPEG()
        Test whether javax.imageio can write JPEGs.
        Returns:
        true if found, otherwise false
      • canDoJAI

        public static boolean canDoJAI()
        Test whether Java Advanced Imaging is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoPython

        public static boolean canDoPython()
        Test whether Jython is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoQuickTime

        public static boolean canDoQuickTime()
        Test whether QuickTime for Java is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoJava3D

        public static boolean canDoJava3D()
        Test whether Java3D is present in this JVM.
        Returns:
        true if found, otherwise false
      • canDoJava3D

        public static boolean canDoJava3D(java.lang.String version)
        Check to see if the version of Java3D being used is compatible with the desired specification version.
        Parameters:
        version - version to check. Needs to conform to the dotted format of specification version numbers (e.g., 1.2)
        Returns:
        true if the Java3D version being used is greater than or equal to the desired version number
      • captureDisplay

        public static void captureDisplay(DisplayImpl display,
                                          java.lang.String filename)
        Capture a DisplayImpl into a JPEG file
        Parameters:
        display - the DisplayImpl to capture
        filename - the name of the file to write into
      • captureDisplay

        public static void captureDisplay(DisplayImpl display,
                                          java.lang.String filename,
                                          boolean sync)
        Capture a DisplayImpl into a JPEG file
        Parameters:
        display - the DisplayImpl to capture
        filename - the name of the file to write into
        sync - ensure the display is "done" if true
      • arraysEqual

        public static boolean arraysEqual(java.lang.Object[] o1,
                                          java.lang.Object[] o2)
        Tests whether two arrays are component-wise equal.
        Parameters:
        o1 -
        o2 -
        Returns:
        true if the arrays are equal
      • printArray

        public static void printArray(java.lang.String prefix,
                                      java.lang.Object[] array)
        Create a string representation of the given array
        Parameters:
        prefix -
        array - array to print
      • printArray

        public static void printArray(java.lang.String prefix,
                                      double[] array)
        Print out the values in a double array.
        Parameters:
        prefix - prefix string
        array - array to print
      • invoke

        public static void invoke(boolean wait,
                                  java.lang.Runnable r)
        Executes the given Runnable object with the Swing event handling thread.
        Parameters:
        wait - true if method should block until Runnable code finishes execution.
        r - Runnable object to execute using the event handling thread.
      • invoke

        public static void invoke(boolean wait,
                                  boolean printStackTraces,
                                  java.lang.Runnable r)
        Executes the given Runnable object with the Swing event handling thread.
        Parameters:
        wait - true if method should block until Runnable code finishes execution.
        printStackTraces - true if the stack trace for any exception should be printed.
        r - Runnable object to execute using the event handling thread.
      • configureLogging

        public static java.util.logging.Level configureLogging(int verbosity,
                                                               java.lang.String pkg)
        Configure basic logging for the visad package. In a production environment the preferred way to configure logging is using the logging.properties file. This is intended only as a convenience method for configuring console logging for the purposes of testing.
        Parameters:
        verbosity - 0 is Level.WARNING and progresses to a maximum of Level.ALL.
        pkg - Name of the java package to configure logging for.
        Returns:
        The Level logging was set to.
      • getStackTrace

        public static java.lang.String getStackTrace()
        Utility method to return the stack trace
        Returns:
        The stack trace
      • clone

        public static float[][] clone(float[][] input)
        do a deep clone
        Parameters:
        input - the array
        Returns:
        cloned array
      • clone

        public static double[][] clone(double[][] input)
        do a deep clone
        Parameters:
        input - the array
        Returns:
        cloned array
      • unsignedShortToInt

        public static int unsignedShortToInt(short s)
        Converts an (unsigned) byte to an unsigned int. Since Java doesn't have an unsigned byte type, this requires some foolery. This solution based on information and code from http://www.rgagnon.com/javadetails/java-0026.html
        Parameters:
        s - The unsigned short to convert
        Returns:
        the unsigned int equivalent
      • unsignedByteToInt

        public static int unsignedByteToInt(byte b)
        Converts an (unsigned) byte to an unsigned int. Since Java doesn't have an unsigned byte type, this requires some foolery. This solution based on information and code from http://www.rgagnon.com/javadetails/java-0026.html
        Parameters:
        b - The unsigned byte to convert
        Returns:
        the unsigned int equivalent
      • unsignedByteToLong

        public static long unsignedByteToLong(byte b)
        Converts an (unsigned) byte to an unsigned long. Since Java doesn't have an unsigned byte type, this requires some foolery. This solution based on information and code from http://www.rgagnon.com/javadetails/java-0026.html
        Parameters:
        b - The unsigned byte to convert
        Returns:
        the unsigned long equivalent

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.