|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.array.Type
public class Type
Primitive numeric data type identifier. Objects in this class are used to
identify the type of the bulk data held in an NDArray
.
This class exemplifies the typesafe enum pattern -- the only possible instances are supplied as static final fields of the class, and these instances are immutable.
Field Summary | |
---|---|
static Type |
BYTE
Object representing primitive data of byte type. |
static Type |
DOUBLE
Object representing primitive data of double type. |
static Type |
FLOAT
Object representing primitive data of float type. |
static Type |
INT
Object representing primitive data of int type. |
static Type |
SHORT
Object representing primitive data of short type. |
Method Summary | |
---|---|
static List |
allTypes()
Returns a list of all the known Types. |
void |
checkArray(Object array,
int minsize)
Checks that a given Object is in fact an array of the primitive type corresponding to this Type, and contains at least a given number of elements; throws an exception if not. |
BadHandler |
defaultBadHandler()
Returns a default bad value handler for this type. |
Number |
defaultBadValue()
Returns the default bad value used for this type. |
int |
getNumBytes()
Returns the number of bytes occupied by this primitive type. |
static Type |
getType(Class cls)
Returns the Type object corresponding to a given java class. |
boolean |
isFloating()
Indicates whether this type represents floating point values. |
Class |
javaClass()
Returns the java primitive class associated with this type. |
double |
maximumValue()
Returns the highest value which can be represented by this type. |
double |
minimumValue()
Returns the lowest (= most negative) value which can be represented by this type. |
Object |
newArray(int size)
Constructs a new primitive array of a requested size and the appropriate type for this object. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Type BYTE
byte
type.
public static final Type SHORT
short
type.
public static final Type INT
int
type.
public static final Type FLOAT
float
type.
public static final Type DOUBLE
double
type.
Method Detail |
---|
public String toString()
toString
in class Object
public int getNumBytes()
public Class javaClass()
public Number defaultBadValue()
public BadHandler defaultBadHandler()
defaultBadValue
method.
public boolean isFloating()
public double minimumValue()
public double maximumValue()
public Object newArray(int size)
Array.newInstance(java.lang.Class>, int)
.
size
- the number of elements required
public void checkArray(Object array, int minsize)
array
- an Object purporting to be a java array of
primitives of the right primitive type for this
Type and of at least minsize elementsminsize
- the minimum satisfactory size of array
IllegalArgumentException
- if array is not an array or
has fewer than minSize elementspublic static List allTypes()
public static Type getType(Class cls)
cls
- a (presumably numeric primitive) class.
May be null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |