|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.array.TypeConverter
public class TypeConverter
A Converter which converts between primitive types, optionally passing the values through a real function. Bad value propagation is taken care of, and conversion overflows lead to bad values in the output data.
Constructor Summary | |
---|---|
TypeConverter(Type type1,
BadHandler handler1,
Type type2,
BadHandler handler2)
Creates a converter from one primitive type to another. |
|
TypeConverter(Type type1,
BadHandler handler1,
Type type2,
BadHandler handler2,
Function func)
Creates a converter from one primitive type to another, which will pass the values through a real function prior to doing the type conversion. |
Method Summary | |
---|---|
void |
convert12(Object src1,
int srcPos,
Object dest2,
int destPos,
int length)
Converts a sequence of elements in an array of type 1 and places the results in a sequence of elements in an array of type 2. |
void |
convert21(Object src2,
int srcPos,
Object dest1,
int destPos,
int length)
Converts a sequence of elements in an array of type 2 and places the results in a sequence of elements in an array of type 1. |
BadHandler |
getBadHandler1()
Gets the bad value handler for end 1 of the converter. |
BadHandler |
getBadHandler2()
Gets the bad value handler for end 2 of the converter. |
Type |
getType1()
Gets the primitive type for end 1 of the converter. |
Type |
getType2()
Gets the primitive type for end 2 of the converter. |
boolean |
isUnit12()
Indicates whether the conversion from type 1 to type 2 is known to be a unit transformation. |
boolean |
isUnit21()
Indicates whether the conversion from type 2 to type 1 is known to be a unit transformation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeConverter(Type type1, BadHandler handler1, Type type2, BadHandler handler2, Function func)
type1
- primitive type for data at end 1 of the conversionhandler1
- a bad value handler for the data at end 1 of
the conversiontype2
- primitive type for data at end 2 of the conversionhandler2
- a bad value handler for the data at end 2 of
the conversionfunc
- a Function object representing an additional
double
function to apply
to values in addition to
the type conversion. The forward mapping will
be used for 1->2 conversions, and the inverse
one for 2->1 conversions. If null, a unit
function is used (efficiently)public TypeConverter(Type type1, BadHandler handler1, Type type2, BadHandler handler2)
type1
- primitive type for data at end 1 of the conversionhandler1
- a bad value handler for the data at end 1 of
the conversiontype2
- primitive type for data at end 2 of the conversionhandler2
- a bad value handler for the data at end 2 of
the conversionMethod Detail |
---|
public Type getType1()
getType1
in interface Converter
public Type getType2()
getType2
in interface Converter
public BadHandler getBadHandler1()
getBadHandler1
in interface Converter
public BadHandler getBadHandler2()
getBadHandler2
in interface Converter
public boolean isUnit12()
isUnit12
in interface Converter
public boolean isUnit21()
isUnit21
in interface Converter
public void convert12(Object src1, int srcPos, Object dest2, int destPos, int length)
convert12
in interface Converter
src1
- array of type 1 containing input valuessrcPos
- starting position of elements to convert in src1dest2
- array of type 2 to reaceive output valuesdestPos
- starting position of elements to write in dest2length
- number of elements to convertpublic void convert21(Object src2, int srcPos, Object dest1, int destPos, int length)
convert21
in interface Converter
src2
- array of type 2 containing input valuessrcPos
- starting position of elements to convert in src2dest1
- array of type 1 to reaceive output valuesdestPos
- starting position of elements to write in dest1length
- number of elements to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |