|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object visad.util.Util
public class Util
A hodge-podge of general utility methods.
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static void |
adjustComboBox(JComboBox combo)
Limit the given combo box to one line in height. |
static void |
adjustTextField(JTextField field)
Limit the given text field to one line in height. |
static boolean |
arraysEqual(Object[] o1,
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(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,
String filename)
Capture a DisplayImpl into a JPEG file |
static void |
captureDisplay(DisplayImpl display,
String filename,
boolean sync)
Capture a DisplayImpl into a JPEG file |
static void |
centerWindow(Window window)
Center the given window on the screen. |
static void |
centerWindow(Window parent,
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 Level |
configureLogging(int verbosity)
|
static Level |
configureLogging(int verbosity,
String pkg)
Configure basic logging for the visad package. |
static ConstantMap[] |
getColorMaps(Color color)
Create a ConstantMap array of colors for use with Display.addReference(DataReference, ConstantMap[]) |
static String |
getName(SceneGraphObject obj)
Gets the name of the given SceneGraphObject . |
static String |
getStackTrace()
Utility method to return the stack trace |
static String |
getTimestamp()
Return a string representation of the current date and time. |
static String |
getVersionDate()
Return a string representation of VisAD's build date and time. |
static JFileChooser |
getVisADFileChooser()
Return a JFileChooser that recognizes supported VisAD file types. |
static void |
invoke(boolean wait,
boolean printStackTraces,
Runnable r)
Executes the given Runnable object with the Swing event handling thread. |
static void |
invoke(boolean wait,
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(String prefix,
double[] array)
Print out the values in a double array. |
static void |
printArray(String prefix,
Object[] array)
Create a string representation of the given array |
static void |
printJ3DProperties(Canvas3D canvas)
Print Java3D global and Canvas3D properties to System.err . |
static void |
printJ3DProperties(PrintStream str,
Canvas3D canvas)
Print Java3D properties. |
static void |
printSceneGraph(Node node)
|
static void |
setName(SceneGraphObject obj,
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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static boolean isApproximatelyEqual(float a, float b, float epsilon)
a
- First numberb
- Second numberepsilon
- Absolute amount by which they can differ.
public static boolean isApproximatelyEqual(float a, float b)
a
- First numberb
- Second number
public static boolean isApproximatelyEqual(double a, double b, double epsilon)
a
- First numberb
- Second numberepsilon
- Absolute amount by which they can differ.
public static boolean isApproximatelyEqual(double a, double b)
a
- First numberb
- Second number
public static String getVersionDate()
public static void printJ3DProperties(PrintStream str, Canvas3D canvas)
str
- Where to print properties.canvas
- The Canvas3D to get properties from. If null Canvas3D
properties are skipped.printJ3DProperties(Canvas3D)
public static void printJ3DProperties(Canvas3D canvas)
System.err
.
canvas
- The Canvas3D to get properties from. If null Canvas3D
properties are skipped.VirtualUniverse.getProperties()
,
Canvas3D.queryProperties()
public static void printSceneGraph(Node node)
node
- public static String getName(SceneGraphObject obj)
SceneGraphObject
.
This method exists to avoid a compile-time
dependency on Java3D 1.4+.
public static void setName(SceneGraphObject obj, String name)
SceneGraphObject
.
This method exists to avoid a compile-time
dependency on Java3D 1.4+.
public static int tenBitToTwoByte(byte[] input, short[] output)
input
- output
-
public static String getTimestamp()
public static JFileChooser getVisADFileChooser()
public static void adjustTextField(JTextField field)
field
- public static void adjustComboBox(JComboBox combo)
combo
- public static void centerWindow(Window window)
window
- public static void centerWindow(Window parent, Window window)
parent
- window
- public static boolean canDoHDF5()
public static boolean canDoImageJ()
public static boolean canDoJPEG()
javax.imageio
can write JPEGs.
public static boolean canDoJAI()
public static boolean canDoPython()
public static boolean canDoQuickTime()
public static boolean canDoJava3D()
public static boolean canDoJava3D(String version)
version
- version to check. Needs to conform to the dotted format
of specification version numbers (e.g., 1.2)
public static void captureDisplay(DisplayImpl display, String filename)
display
- the DisplayImpl to capturefilename
- the name of the file to write intopublic static void captureDisplay(DisplayImpl display, String filename, boolean sync)
display
- the DisplayImpl to capturefilename
- the name of the file to write intosync
- ensure the display is "done" if truepublic static boolean arraysEqual(Object[] o1, Object[] o2)
o1
- o2
-
public static void printArray(String prefix, Object[] array)
prefix
- array
- array to printpublic static void printArray(String prefix, double[] array)
prefix
- prefix stringarray
- array to printpublic static void invoke(boolean wait, Runnable r)
wait
- true if method should block until Runnable code
finishes execution.r
- Runnable object to execute using the event handling thread.public static void invoke(boolean wait, boolean printStackTraces, Runnable r)
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.public static ConstantMap[] getColorMaps(Color color) throws VisADException
Display.addReference(DataReference, ConstantMap[])
color
- color to encode
VisADException
public static Level configureLogging(int verbosity, String pkg)
verbosity
- 0 is Level.WARNING
and progresses to a
maximum of Level.ALL
.pkg
- Name of the java package to configure logging for.
Level
logging was set to.public static Level configureLogging(int verbosity)
verbosity
-
configureLogging(int, java.lang.String)
public static String getStackTrace()
public static float[][] clone(float[][] input)
input
- the array
public static double[][] clone(double[][] input)
input
- the array
public static int unsignedShortToInt(short s)
s
- The unsigned short to convert
public static int unsignedByteToInt(byte b)
b
- The unsigned byte to convert
public static long unsignedByteToLong(byte b)
b
- The unsigned byte to convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |