WISA.wisa3D.util
Class Util

java.lang.Object
  |
  +--WISA.wisa3D.util.Util

public class Util
extends java.lang.Object

The Util-class holds a couple of methods which make working with Wisa3D much easier.


Constructor Summary
Util()
           
 
Method Summary
static boolean arrayCheck(java.lang.Object[] array)
          Checks the passed array if it is valid.
static void centerWindow(java.awt.Window window)
          Centers the window on the screen.
static int concatArray(java.lang.Object[] source1, java.lang.Object[] source2, java.lang.Object[] target)
          Concatenates two arrays.
static visad.ScalarMap[] getScalarMapByDisplayType(visad.ScalarMap[] maps, visad.DisplayRealType type)
          Searches in the passed ScalarMap-array for those ScalarMaps with the also passed DisplayRealType and returns them in an array or null if no such exists.
static visad.MathType[] getSubTypes(visad.MathType type, boolean domain)
          Performs a recursive search and lists all basic MathTypes which are contained in the passed MathType.
static java.awt.Window getWindow(java.awt.Component component)
          Returns the Window the component is in.
static int subArray(java.lang.Object[] source, java.lang.Object[] subsource, java.lang.Object[] target)
          Removes all elements which are both included in source and subsource from source and stores the result in target.
 
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

concatArray

public static int concatArray(java.lang.Object[] source1,
                              java.lang.Object[] source2,
                              java.lang.Object[] target)
Concatenates two arrays.

Parameters:
source1 - The first source-array whose data is copied to the beginning of the target-array.
source2 - The second source-array whose data is copied to the end of the target-array.
target - The target-array.
Returns:
The length of the target-array if no errors occured, -1 otherwise.

subArray

public static int subArray(java.lang.Object[] source,
                           java.lang.Object[] subsource,
                           java.lang.Object[] target)
Removes all elements which are both included in source and subsource from source and stores the result in target.

Parameters:
source - The initial array.
subsource - The array which holds the elements to remove
target - The target array. After the method is finished here are all elements contained in source but not in subsource.
Returns:
The length of the target-array or -1 if an error has occured.

getScalarMapByDisplayType

public static visad.ScalarMap[] getScalarMapByDisplayType(visad.ScalarMap[] maps,
                                                          visad.DisplayRealType type)
Searches in the passed ScalarMap-array for those ScalarMaps with the also passed DisplayRealType and returns them in an array or null if no such exists.

Parameters:
maps - The ScalarMaps to be searched.
type - The DisplayRealType to be searched for.
Returns:
The searched for ScalarMaps or null if not found.

getSubTypes

public static visad.MathType[] getSubTypes(visad.MathType type,
                                           boolean domain)
Performs a recursive search and lists all basic MathTypes which are contained in the passed MathType. Basic MathTypes are those MathTypes which do not contain any further MathTypes.

Parameters:
type - The MathType to be scanned.
domain - If true even the domain-set will be scanned.
Returns:
All basic MathTypes contained in the passed MathType.

centerWindow

public static void centerWindow(java.awt.Window window)
Centers the window on the screen.

Parameters:
window - The window to be centered.

arrayCheck

public static boolean arrayCheck(java.lang.Object[] array)
Checks the passed array if it is valid. An array is valid if it is not null and its length is bigger than 0.

Returns:
True if the array is ok, false otherwise.

getWindow

public static java.awt.Window getWindow(java.awt.Component component)
Returns the Window the component is in. The Window could be every instance of the java.awt.Window or its subclasses.

Parameters:
component - The component to be inspected.
Returns:
The Window the component is in or null.