ucar.ma2
Class DataType

java.lang.Object
  extended by ucar.ma2.DataType

public class DataType
extends java.lang.Object

Type-safe enumeration of data types.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
john caron

Field Summary
static DataType BOOLEAN
           
static DataType BYTE
           
static DataType CHAR
           
static DataType DOUBLE
           
static DataType FLOAT
           
static DataType INT
           
static DataType LONG
           
static DataType SHORT
           
static DataType STRING
           
static DataType STRUCTURE
           
 
Method Summary
 java.lang.Class getClassType()
          The Object class type: Character, Byte, Float, Double, Short, Integer, Boolean, Long, String, StructureData.
 java.lang.Class getPrimitiveClassType()
          The primitive class type: char, byte, float, double, short, int, long, boolean, String, StructureData.
 int getSize()
          Size in bytes of one element of this data type.
static DataType getType(java.lang.Class c)
          Find the DataType that matches this class.
static DataType getType(java.lang.String name)
          Find the DataType that matches this name.
 java.lang.String toString()
          The DataType name, eg "byte", "float", "String".
static short unsignedByteToShort(byte b)
          widen an unsigned byte to a short
static long unsignedIntToLong(int i)
          widen an unsigned int to a long
static int unsignedShortToInt(short s)
          widen an unsigned short to an int
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOOLEAN

public static final DataType BOOLEAN

BYTE

public static final DataType BYTE

CHAR

public static final DataType CHAR

SHORT

public static final DataType SHORT

INT

public static final DataType INT

LONG

public static final DataType LONG

FLOAT

public static final DataType FLOAT

DOUBLE

public static final DataType DOUBLE

STRING

public static final DataType STRING

STRUCTURE

public static final DataType STRUCTURE
Method Detail

getType

public static DataType getType(java.lang.String name)
Find the DataType that matches this name.

Parameters:
name - find DataTYpe with this name.
Returns:
DataType or null if no match.

getType

public static DataType getType(java.lang.Class c)
Find the DataType that matches this class.

Parameters:
c - primitive or object class, eg float.class or Float.class
Returns:
DataType or null if no match.

toString

public java.lang.String toString()
The DataType name, eg "byte", "float", "String".

Overrides:
toString in class java.lang.Object

getSize

public int getSize()
Size in bytes of one element of this data type. Strings dont know, so return 0. Structures return 1.


getPrimitiveClassType

public java.lang.Class getPrimitiveClassType()
The primitive class type: char, byte, float, double, short, int, long, boolean, String, StructureData.


getClassType

public java.lang.Class getClassType()
The Object class type: Character, Byte, Float, Double, Short, Integer, Boolean, Long, String, StructureData.


unsignedIntToLong

public static long unsignedIntToLong(int i)
widen an unsigned int to a long


unsignedShortToInt

public static int unsignedShortToInt(short s)
widen an unsigned short to an int


unsignedByteToShort

public static short unsignedByteToShort(byte b)
widen an unsigned byte to a short