Package org.esa.snap.core.datamodel
Class ProductData.UShort
java.lang.Object
org.esa.snap.core.datamodel.ProductData
org.esa.snap.core.datamodel.ProductData.Short
org.esa.snap.core.datamodel.ProductData.UShort
- All Implemented Interfaces:
Cloneable
- Enclosing class:
ProductData
The
UShort class is a ProductData specialisation for unsigned 16-bit integer fields.
Internally, data is stored in an array of the type short[].
In order to preserve the accuracy for the unsigned byte value range the getElemIntAt method
should be used to retrieve the data stored in this value instead of accessing the data array directly.
Another method is to mask each of the array elements in order to get the unsigned type in the following way:
short[] data = (short[]) value.getRaster();
for (int i = 0; i < data.length; i++) {
int value = data[i] & 0xffff;
...
}
-
Nested Class Summary
Nested classes/interfaces inherited from class org.esa.snap.core.datamodel.ProductData
ProductData.ASCII, ProductData.Byte, ProductData.Double, ProductData.Float, ProductData.Int, ProductData.Long, ProductData.Short, ProductData.UByte, ProductData.UInt, ProductData.UShort, ProductData.UTC -
Field Summary
Fields inherited from class org.esa.snap.core.datamodel.ProductData.Short
_arrayFields inherited from class org.esa.snap.core.datamodel.ProductData
TYPE_ASCII, TYPE_FLOAT32, TYPE_FLOAT64, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_UNDEFINED, TYPE_UTC, TYPESTRING_ASCII, TYPESTRING_FLOAT32, TYPESTRING_FLOAT64, TYPESTRING_INT16, TYPESTRING_INT32, TYPESTRING_INT64, TYPESTRING_INT8, TYPESTRING_UINT16, TYPESTRING_UINT32, TYPESTRING_UINT64, TYPESTRING_UINT8, TYPESTRING_UTC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ProductDataRetuns a "deep" copy of this product data.doublegetElemDoubleAt(int index) Please refer toProductData.getElemDoubleAt(int).floatgetElemFloatAt(int index) Please refer toProductData.getElemFloatAt(int).intgetElemIntAt(int index) Please refer toProductData.getElemIntAt(int).getElemStringAt(int index) Please refer toProductData.getElemStringAt(int).longgetElemUIntAt(int index) Please refer toProductData.getElemUIntAt(int).voidSets the data of this value.Methods inherited from class org.esa.snap.core.datamodel.ProductData.Short
dispose, getArray, getElemLongAt, getElems, getNumElems, readFrom, setElemDoubleAt, setElemFloatAt, setElemIntAt, setElemLongAt, setElemUIntAt, writeToMethods inherited from class org.esa.snap.core.datamodel.ProductData
createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createUnsignedInstance, createUnsignedInstance, createUnsignedInstance, equalElems, equals, getElemBoolean, getElemBooleanAt, getElemDouble, getElemFloat, getElemInt, getElemLong, getElemSize, getElemSize, getElemString, getElemUInt, getType, getType, getTypeString, getTypeString, hashCode, isFloatingPointType, isInt, isIntType, isScalar, isSigned, isUIntType, isUnsigned, readFrom, readFrom, readFrom, setElemBoolean, setElemBooleanAt, setElemDouble, setElemFloat, setElemInt, setElemLong, setElemString, setElemStringAt, setElemUInt, toString, writeTo, writeTo, writeTo
-
Constructor Details
-
UShort
public UShort(int numElems) Constructs a new unsignedshortvalue.- Parameters:
numElems- the number of elements, must not be less than one
-
UShort
public UShort(short[] array) Constructs a new unsignedshortvalue.- Parameters:
array- the elements
-
-
Method Details
-
createDeepClone
Retuns a "deep" copy of this product data.- Overrides:
createDeepClonein classProductData.Short- Returns:
- a copy of this product data
-
getElemIntAt
public int getElemIntAt(int index) Please refer toProductData.getElemIntAt(int).- Overrides:
getElemIntAtin classProductData.Short- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemUIntAt
public long getElemUIntAt(int index) Please refer toProductData.getElemUIntAt(int).- Overrides:
getElemUIntAtin classProductData.Short- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemFloatAt
public float getElemFloatAt(int index) Please refer toProductData.getElemFloatAt(int).- Overrides:
getElemFloatAtin classProductData.Short- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemDoubleAt
public double getElemDoubleAt(int index) Please refer toProductData.getElemDoubleAt(int).- Overrides:
getElemDoubleAtin classProductData.Short- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemStringAt
Please refer toProductData.getElemStringAt(int).- Overrides:
getElemStringAtin classProductData.Short- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
setElems
Sets the data of this value. The data must be an array of the typeshort[]orString[]and have a length that is equal to the value returned by thegetNumDataElemsmethod.- Overrides:
setElemsin classProductData.Short- Parameters:
data- the data array- Throws:
IllegalArgumentException- if data isnullor it is not an array of the required type or does not have the required array length.
-