anl.aida.data
Class ArrayFactory

java.lang.Object
  extended by anl.aida.data.ArrayFactory

public class ArrayFactory
extends java.lang.Object

Factory for creating arrays.

Version:
$Revision$ $Date$

Field Summary
(package private) static java.util.Map<java.lang.Class,java.util.Map<java.lang.Class,java.lang.Class>> conversionMap
           
 
Constructor Summary
ArrayFactory()
           
 
Method Summary
static ucar.ma2.Array createArray(ucar.ma2.Array... arrays)
          Creates an array whose element type is sufficient to hold all the values in each of the passed in arrays.
static ucar.ma2.Array createDoubleArray(int[] shape)
          Creates a double array of the specified shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conversionMap

static java.util.Map<java.lang.Class,java.util.Map<java.lang.Class,java.lang.Class>> conversionMap
Constructor Detail

ArrayFactory

public ArrayFactory()
Method Detail

createArray

public static ucar.ma2.Array createArray(ucar.ma2.Array... arrays)
                                  throws java.lang.IllegalArgumentException
Creates an array whose element type is sufficient to hold all the values in each of the passed in arrays. Only works with primitive numeric types.

Parameters:
arrays - the arrays whose types the created array must be able to hold.
Returns:
the created array
Throws:
java.lang.IllegalArgumentException - if the passed in arrays do not have the same shape, or array element type is not an int, float, long or double.

createDoubleArray

public static ucar.ma2.Array createDoubleArray(int[] shape)
Creates a double array of the specified shape. This will attempt to use the more efficient ArrayDouble.D* classes if possible.

Parameters:
shape - the shape of the created array
Returns:
the created array.