From e3d2604fd97b7acefc24b710f1c4cf9b8415f0f0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Apr 2024 17:24:08 -0500 Subject: [PATCH 01/16] Add support for float16 datatypes --- .../DataDisplayConverterFactory.java | 11 +- .../view/TableView/DataProviderFactory.java | 86 +++++++++++- .../view/TableView/DataValidatorFactory.java | 26 ++-- .../dialog/NewCompoundAttributeDialog.java | 17 ++- .../view/dialog/NewCompoundDatasetDialog.java | 125 +++++++++++------- .../view/dialog/NewStringAttributeDialog.java | 36 ++++- .../hdf/object/Dataset.java | 29 ++++ .../hdf/object/h5/H5Datatype.java | 9 +- .../hdf/object/h5/H5ScalarDS.java | 8 +- .../uitest/tfloat16.h5 | Bin 0 -> 2304 bytes .../misc/DebugHDF.java | 11 ++ 11 files changed, 280 insertions(+), 78 deletions(-) create mode 100644 test/org.hdfgroup.hdfview.test/uitest/tfloat16.h5 diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java index 5f858ba0..c83844c9 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java @@ -710,8 +710,9 @@ private static class NumericalDataDisplayConverter extends HDFDisplayConverter { private static final Logger log = LoggerFactory.getLogger(NumericalDataDisplayConverter.class); private final StringBuilder buffer; - private final long typeSize; - private final boolean isUINT64; + private final long typeSize; + private final boolean isUINT64; + private final boolean isFLT16; NumericalDataDisplayConverter(final Datatype dtype) throws Exception { @@ -727,6 +728,7 @@ private static class NumericalDataDisplayConverter extends HDFDisplayConverter { typeSize = dtype.getDatatypeSize(); isUINT64 = dtype.isUnsigned() && (typeSize == 8); + isFLT16 = dtype.isFloat() && (typeSize == 2); } @Override @@ -761,7 +763,10 @@ else if (numberFormat != null) { buffer.append(numberFormat.format(value)); } else { - buffer.append(value.toString()); + if (isFLT16) + buffer.append(Float.toString(Float.float16ToFloat((short) value))); + else + buffer.append(value.toString()); } } catch (Exception ex) { diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 71ede170..41fc9b19 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -94,6 +94,7 @@ private static final HDFDataProvider getDataProvider(final Datatype dtype, final final boolean dataTransposed) throws Exception { HDFDataProvider dataProvider = null; + log.debug("getDataProvider(): Datatype is {}", dtype.getDescription()); try { if (dtype.isCompound()) @@ -1623,8 +1624,8 @@ private static class NumericalDataProvider extends HDFDataProvider { private static final Logger log = LoggerFactory.getLogger(NumericalDataProvider.class); private final boolean isUINT64; - - private final long typeSize; + private final boolean isFLT16; + private final long typeSize; NumericalDataProvider(final Datatype dtype, final Object dataBuf, final boolean dataTransposed) throws Exception @@ -1633,6 +1634,7 @@ private static class NumericalDataProvider extends HDFDataProvider { typeSize = dtype.getDatatypeSize(); isUINT64 = dtype.isUnsigned() && (typeSize == 8); + isFLT16 = dtype.isFloat() && (typeSize == 2); } @Override @@ -1641,7 +1643,9 @@ public Object getDataValue(int columnIndex, int rowIndex) super.getDataValue(columnIndex, rowIndex); try { - if (isUINT64) + if (isFLT16) + theValue = Float.toString(Float.float16ToFloat((short) theValue)); + else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } catch (Exception ex) { @@ -1660,7 +1664,9 @@ public Object getDataValue(Object obj, int index) super.getDataValue(obj, index); try { - if (isUINT64) + if (isFLT16) + theValue = Float.toString(Float.float16ToFloat((short) theValue)); + else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } catch (Exception ex) { @@ -1672,6 +1678,78 @@ public Object getDataValue(Object obj, int index) return theValue; } + + /** + * update the data value of a compound type. + * + * @param columnIndex the column + * @param rowIndex the row + * @param newValue the new data value object + */ + @Override + public void setDataValue(int columnIndex, int rowIndex, Object newValue) + { + Object theValue = newValue; + if (isFLT16) + theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + + super.setDataValue(columnIndex, rowIndex, theValue); + } + + /** + * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or when a + * top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a base + * CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and row index. This + * method is for facilitating this behavior. + * + * In general, all "container" DataProviders that have a "container" base DataProvider should call down into + * their base DataProvider(s) using this{}, method, in order to ensure that buried CompoundDataProviders get + * handled correctly. When their base DataProvider is not a "container" type, the method setDataValue(index, + * Object, Object) should be used instead. + * + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, + * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type + * DataProviders. + * + * @param columnIndex the column + * @param rowIndex the row + * @param bufObject the data object + * @param newValue the new data object + */ + public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object newValue) + { + Object newbufObject = bufObject; + if (isFLT16) + newbufObject = Float.float16ToFloat((short) bufObject); + setDataValue(rowIndex, newbufObject, newValue); + } + + /** + * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing the + * operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the direct index + * to have the base provider use. This method is to facilitate this kind of behavior. + * + * Note that this method takes two Object parameters, one which is the object that the method should set its + * data inside of and one which is the new value to set. This is to be able to nicely support nested compound + * DataProviders. + * + * @param index the index into the data array + * @param bufObject the data object + * @param newValue the new data object + */ + public void setDataValue(int index, Object bufObject, Object newValue) + { + Object newbufObject = bufObject; + if (isFLT16) + newbufObject = Float.float16ToFloat((short) bufObject); + try { + setDataValue(index, newbufObject, newValue); + } + catch (Exception ex) { + log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, newValue, ex); + } + log.trace("setDataValue({}, {})=({}): finish", index, newbufObject, newValue); + } } private static class EnumDataProvider extends HDFDataProvider { diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java index 2c0ac246..150efedd 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java @@ -636,19 +636,25 @@ public boolean validate(int colIndex, int rowIndex, Object newValue) break; case 2: - if (datasetDatatype.isUnsigned()) { - /* - * First try to parse as a larger type in order to catch a NumberFormatException - */ - Integer intValue = Integer.parseInt((String)newValue); - if (intValue < 0) - throw new NumberFormatException("Invalid negative value for unsigned datatype"); + if (datasetDatatype.isInteger()) { + if (datasetDatatype.isUnsigned()) { + /* + * First try to parse as a larger type in order to catch a NumberFormatException + */ + Integer intValue = Integer.parseInt((String) newValue); + if (intValue < 0) + throw new NumberFormatException("Invalid negative value for unsigned datatype"); - if (intValue > (Short.MAX_VALUE * 2) + 1) - throw new NumberFormatException("Value out of range. Value:\"" + newValue + "\""); + if (intValue > (Short.MAX_VALUE * 2) + 1) + throw new NumberFormatException("Value out of range. Value:\"" + newValue + "\""); + } + else { + Short.parseShort((String) newValue); + } } else { - Short.parseShort((String)newValue); + /* Floating-point type */ + Float.parseFloat((String) newValue); } break; diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java index d08d1577..0a463380 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java @@ -78,11 +78,13 @@ public class NewCompoundAttributeDialog extends NewDataObjectDialog { "unsigned short (16-bit)", // 4 "unsigned int (32-bit)", // 5 "long (64-bit)", // 6 - "float", // 7 - "double", // 8 + "float (32-bit)", // 7 + "double (64-bit)", // 8 "string", // 9 "enum", // 10 - "unsigned long (64-bit)" // 11 + "unsigned long (64-bit)", // 11 + "float16 (16-bit)", // 12 + "long double (128-bit)" // 13 }; private Combo nFieldBox, templateChoice; @@ -463,7 +465,14 @@ else if (DATATYPE_NAMES[10].equals(typeName)) { // enum } else if (DATATYPE_NAMES[11].equals(typeName)) { type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, - Datatype.SIGN_NONE); + Datatype.SIGN_NONE); + } + else if (DATATYPE_NAMES[12].equals(typeName)) { + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + } + else if (DATATYPE_NAMES[13].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); } else { throw new IllegalArgumentException("Invalid data type."); diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java index 05f16a35..027c4d22 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java @@ -78,11 +78,13 @@ public class NewCompoundDatasetDialog extends NewDataObjectDialog { "unsigned short (16-bit)", // 4 "unsigned int (32-bit)", // 5 "long (64-bit)", // 6 - "float", // 7 - "double", // 8 + "float (32-bit)", // 7 + "double (64-bit)", // 8 "string", // 9 "enum", // 10 - "unsigned long (64-bit)" // 11 + "unsigned long (64-bit)", // 11 + "float16 (16-bit)", // 12 + "long double (128-bit)" // 13 }; private Combo parentChoice, nFieldBox, templateChoice; @@ -808,59 +810,80 @@ private HObject createCompoundDS() throws Exception String typeName = (String)table.getItem(i).getData("MemberType"); log.trace("createCompoundDS type[{}] name = {}", i, typeName); Datatype type = null; - if (DATATYPE_NAMES[0].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 1, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[1].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 2, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[2].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 4, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[3].equals(typeName)) { - type = - fileFormat.createDatatype(Datatype.CLASS_INTEGER, 1, Datatype.NATIVE, Datatype.SIGN_NONE); - } - else if (DATATYPE_NAMES[4].equals(typeName)) { - type = - fileFormat.createDatatype(Datatype.CLASS_INTEGER, 2, Datatype.NATIVE, Datatype.SIGN_NONE); - } - else if (DATATYPE_NAMES[5].equals(typeName)) { - type = - fileFormat.createDatatype(Datatype.CLASS_INTEGER, 4, Datatype.NATIVE, Datatype.SIGN_NONE); - } - else if (DATATYPE_NAMES[6].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[7].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 4, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[8].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[9].equals(typeName)) { - type = - fileFormat.createDatatype(Datatype.CLASS_STRING, order, Datatype.NATIVE, Datatype.NATIVE); - } - else if (DATATYPE_NAMES[10].equals(typeName)) { // enum - type = fileFormat.createDatatype(Datatype.CLASS_ENUM, 4, Datatype.NATIVE, Datatype.NATIVE); - if ((orderStr == null) || (orderStr.length() < 1) || orderStr.endsWith("...")) { - shell.getDisplay().beep(); - Tools.showError(shell, "Create", "Invalid member values: " + orderStr); - return null; + try { + if (DATATYPE_NAMES[0].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 1, Datatype.NATIVE, + Datatype.NATIVE); + } + else if (DATATYPE_NAMES[1].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 2, Datatype.NATIVE, + Datatype.NATIVE); + } + else if (DATATYPE_NAMES[2].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 4, Datatype.NATIVE, + Datatype.NATIVE); + } + else if (DATATYPE_NAMES[3].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 1, Datatype.NATIVE, + Datatype.SIGN_NONE); + } + else if (DATATYPE_NAMES[4].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 2, Datatype.NATIVE, + Datatype.SIGN_NONE); + } + else if (DATATYPE_NAMES[5].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 4, Datatype.NATIVE, + Datatype.SIGN_NONE); + } + else if (DATATYPE_NAMES[6].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, + Datatype.NATIVE); + } + else if (DATATYPE_NAMES[7].equals(typeName)) { + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 4, Datatype.NATIVE, Datatype.NATIVE); + } + else if (DATATYPE_NAMES[8].equals(typeName)) { + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE); + } + else if (DATATYPE_NAMES[9].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_STRING, order, Datatype.NATIVE, + Datatype.NATIVE); + } + else if (DATATYPE_NAMES[10].equals(typeName)) { // enum + type = + fileFormat.createDatatype(Datatype.CLASS_ENUM, 4, Datatype.NATIVE, Datatype.NATIVE); + if ((orderStr == null) || (orderStr.length() < 1) || orderStr.endsWith("...")) { + shell.getDisplay().beep(); + Tools.showError(shell, "Create", "Invalid member values: " + orderStr); + return null; + } + else { + type.setEnumMembers(orderStr); + } + } + else if (DATATYPE_NAMES[11].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, + Datatype.SIGN_NONE); + } + else if (DATATYPE_NAMES[12].equals(typeName)) { + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + } + else if (DATATYPE_NAMES[13].equals(typeName)) { + type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); } else { - type.setEnumMembers(orderStr); + throw new IllegalArgumentException("Invalid data type."); } + mDatatypes[i] = type; } - else if (DATATYPE_NAMES[11].equals(typeName)) { - type = - fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, Datatype.SIGN_NONE); - } - else { - throw new IllegalArgumentException("Invalid data type."); + catch (Exception ex) { + Tools.showError(shell, "Create", ex.getMessage()); + log.debug("createAttribute(): ", ex); + return null; } - mDatatypes[i] = type; } // (int i=0; i 0 && strValue.length() > count) + // truncate the extra characters + // strValue = strValue.substring(0, count); + sb.append(strValue); + + for (int i = 1; i < count; i++) { + sb.append(delimiter); + value = Array.get(theData, i); + + if (value == null) + strValue = "null"; + else + strValue = Float.toString(Float.float16ToFloat((short) value)); + + if (count > 0 && strValue.length() > count) + // truncate the extra characters + strValue = strValue.substring(0, count); + sb.append(strValue); + } + } else if (theType.isUnsigned()) { String cname = valClass.getName(); char dname = cname.charAt(cname.lastIndexOf('[') + 1); diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java index 96bb7c3b..3ba04c0c 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java @@ -1420,9 +1420,11 @@ else if (datatypeOrder == Datatype.ORDER_LE) { try { if (datatypeSize > 8) tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_LDOUBLE); + else if (datatypeSize == 8) + tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_DOUBLE); else - tid = H5.H5Tcopy((datatypeSize == 8) ? HDF5Constants.H5T_NATIVE_DOUBLE - : HDF5Constants.H5T_NATIVE_FLOAT); + tid = H5.H5Tcopy( + (datatypeSize == 4) ? HDF5Constants.H5T_NATIVE_FLOAT : HDF5Constants.H5T_NATIVE_FLOAT16); if (datatypeOrder == Datatype.ORDER_BE) { H5.H5Tset_order(tid, HDF5Constants.H5T_ORDER_BE); @@ -1780,6 +1782,9 @@ else if (typeClass == HDF5Constants.H5T_FLOAT) { typeSize = H5.H5Tget_size(HDF5Constants.H5T_NATIVE_FLOAT); switch ((int)typeSize) { + case 2: + data = new short[numPoints]; + break; case 4: data = new float[numPoints]; break; diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java index a900cc3b..e0eaafeb 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java @@ -1052,7 +1052,7 @@ else if (dsDatatype.isArray() && dsDatatype.getDatatypeBase().isFloat() && } else if (dsDatatype.isRef() && (theData instanceof byte[])) { log.trace( - "AttributeCommonIO():read ioType isRef: converting byte array to List of bytes"); + "scalarDatasetCommonIO():read ioType isRef: converting byte array to List of bytes"); ArrayList theListData = new ArrayList<>((int)totalSelectedSpacePoints); for (int m = 0; m < (int)totalSelectedSpacePoints; m++) { byte[] curBytes = new byte[(int)dsDatatype.getDatatypeSize()]; @@ -1062,7 +1062,7 @@ else if (dsDatatype.isRef() && (theData instanceof byte[])) { theListData.add(curBytes); } catch (Exception err) { - log.trace("AttributeCommonIO(): arraycopy failure: ", err); + log.trace("scalarDatasetCommonIO(): arraycopy failure: ", err); } } theData = theListData; @@ -2386,8 +2386,10 @@ else if (datatypeSize == 8) data = valStr.getBytes(); else if (datatypeSize == 8) data = HDFNativeData.doubleToByte(valDbl); + else if (datatypeSize == 4) + data = HDFNativeData.floatToByte((float) valDbl); else - data = HDFNativeData.floatToByte((float)valDbl); + data = HDFNativeData.shortToByte((short) Float.floatToFloat16((float) valDbl)); break; case Datatype.CLASS_STRING: log.trace("parseFillValue(): class CLASS_STRING"); diff --git a/test/org.hdfgroup.hdfview.test/uitest/tfloat16.h5 b/test/org.hdfgroup.hdfview.test/uitest/tfloat16.h5 new file mode 100644 index 0000000000000000000000000000000000000000..a0cccc57edc64d34601b9e6c4482ef7d9b68aa90 GIT binary patch literal 2304 zcmeHHy^hmB5FRHN$rpjnhbYihTT+?^-A{hT_RMZ_hrl9NP`ZISCFPXRNl{^F|+dV2CY z3(cU_yZ8C>aTWZaOALX3#0cVEzi#Uk`nG3?297!CF-*;&Kin(7%e+(<;EtNWcm(4M ze~yvo9}FB}>?dW|eb}u~Lhrru;V$^CX}>0Zp1zM;0V{>h^DXi6VEw;(HYkKEO3hUo6wchEq*_jiP&T&gUaozj@ Drpn}y literal 0 HcmV?d00001 diff --git a/test/org.hdfgroup.object.test/misc/DebugHDF.java b/test/org.hdfgroup.object.test/misc/DebugHDF.java index 44c2697f..f4624411 100644 --- a/test/org.hdfgroup.object.test/misc/DebugHDF.java +++ b/test/org.hdfgroup.object.test/misc/DebugHDF.java @@ -1147,6 +1147,9 @@ private static final void createINF(String fname) throws Exception dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE); testFile.createScalarDS("f64", root, dtype, dims2D, null, null, 0, data2); + dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + testFile.createScalarDS("f16", root, dtype, dims2D, null, null, 0, data2); + testFile.close(); } @@ -3380,6 +3383,10 @@ private static void createDataset(final String fname) throws Exception dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 4, Datatype.NATIVE, Datatype.NATIVE); testFile.createScalarDS("3D float", g2, dtype, dims3D, null, null, 0, null); + // create 3D 16-bit (2 bytes) float16 dataset of 20 by 10 by 5 + dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + testFile.createScalarDS("3D float16", g2, dtype, dims3Dh, null, null, 0, null); + // close file resource testFile.close(); } @@ -3435,6 +3442,10 @@ private static void createStrDataset(final String fname) throws Exception dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 4, Datatype.NATIVE, Datatype.NATIVE); testFile.createScalarDS("3D 32-bit float 20x10x5", g2, dtype, dims3D, null, null, 0, null); + // Create 3D 16-bit (2 bytes) float dataset of 20 by 10 by 5 + dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + testFile.createScalarDS("3D 16-bit float16 20x10x5", g2, dtype, dims3Dh, null, null, 0, null); + // Create String dataset System.out.println("Just before call for STRINGS"); try { From 55f8b2bf8868ddbd050399982e049882b0d9a79b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 22:24:49 +0000 Subject: [PATCH 02/16] Committing clang-format changes --- .../DataDisplayConverterFactory.java | 10 ++-- .../view/TableView/DataProviderFactory.java | 51 ++++++++++--------- .../view/TableView/DataValidatorFactory.java | 12 +++-- .../dialog/NewCompoundAttributeDialog.java | 5 +- .../view/dialog/NewCompoundDatasetDialog.java | 5 +- .../hdf/object/Dataset.java | 4 +- .../hdf/object/h5/H5Datatype.java | 4 +- .../hdf/object/h5/H5ScalarDS.java | 6 +-- 8 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java index c83844c9..be6f7291 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java @@ -710,9 +710,9 @@ private static class NumericalDataDisplayConverter extends HDFDisplayConverter { private static final Logger log = LoggerFactory.getLogger(NumericalDataDisplayConverter.class); private final StringBuilder buffer; - private final long typeSize; - private final boolean isUINT64; - private final boolean isFLT16; + private final long typeSize; + private final boolean isUINT64; + private final boolean isFLT16; NumericalDataDisplayConverter(final Datatype dtype) throws Exception { @@ -728,7 +728,7 @@ private static class NumericalDataDisplayConverter extends HDFDisplayConverter { typeSize = dtype.getDatatypeSize(); isUINT64 = dtype.isUnsigned() && (typeSize == 8); - isFLT16 = dtype.isFloat() && (typeSize == 2); + isFLT16 = dtype.isFloat() && (typeSize == 2); } @Override @@ -764,7 +764,7 @@ else if (numberFormat != null) { } else { if (isFLT16) - buffer.append(Float.toString(Float.float16ToFloat((short) value))); + buffer.append(Float.toString(Float.float16ToFloat((short)value))); else buffer.append(value.toString()); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 41fc9b19..936a19c3 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1625,7 +1625,7 @@ private static class NumericalDataProvider extends HDFDataProvider { private final boolean isUINT64; private final boolean isFLT16; - private final long typeSize; + private final long typeSize; NumericalDataProvider(final Datatype dtype, final Object dataBuf, final boolean dataTransposed) throws Exception @@ -1634,7 +1634,7 @@ private static class NumericalDataProvider extends HDFDataProvider { typeSize = dtype.getDatatypeSize(); isUINT64 = dtype.isUnsigned() && (typeSize == 8); - isFLT16 = dtype.isFloat() && (typeSize == 2); + isFLT16 = dtype.isFloat() && (typeSize == 2); } @Override @@ -1644,7 +1644,7 @@ public Object getDataValue(int columnIndex, int rowIndex) try { if (isFLT16) - theValue = Float.toString(Float.float16ToFloat((short) theValue)); + theValue = Float.toString(Float.float16ToFloat((short)theValue)); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } @@ -1665,7 +1665,7 @@ public Object getDataValue(Object obj, int index) try { if (isFLT16) - theValue = Float.toString(Float.float16ToFloat((short) theValue)); + theValue = Float.toString(Float.float16ToFloat((short)theValue)); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } @@ -1691,25 +1691,25 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) { Object theValue = newValue; if (isFLT16) - theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); super.setDataValue(columnIndex, rowIndex, theValue); } /** - * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or when a - * top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a base - * CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and row index. This - * method is for facilitating this behavior. + * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or + * when a top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a + * base CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and + * row index. This method is for facilitating this behavior. * - * In general, all "container" DataProviders that have a "container" base DataProvider should call down into - * their base DataProvider(s) using this{}, method, in order to ensure that buried CompoundDataProviders get - * handled correctly. When their base DataProvider is not a "container" type, the method setDataValue(index, - * Object, Object) should be used instead. + * In general, all "container" DataProviders that have a "container" base DataProvider should call + * down into their base DataProvider(s) using this{}, method, in order to ensure that buried + * CompoundDataProviders get handled correctly. When their base DataProvider is not a "container" + * type, the method setDataValue(index, Object, Object) should be used instead. * - * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, - * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type - * DataProviders. + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, + * Object, Object) using the passed rowIndex. However, this method should, in general, not be called + * by atomic type DataProviders. * * @param columnIndex the column * @param rowIndex the row @@ -1720,18 +1720,18 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Float.float16ToFloat((short) bufObject); + newbufObject = Float.float16ToFloat((short)bufObject); setDataValue(rowIndex, newbufObject, newValue); } /** - * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing the - * operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the direct index - * to have the base provider use. This method is to facilitate this kind of behavior. + * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing + * the operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the + * direct index to have the base provider use. This method is to facilitate this kind of behavior. * - * Note that this method takes two Object parameters, one which is the object that the method should set its - * data inside of and one which is the new value to set. This is to be able to nicely support nested compound - * DataProviders. + * Note that this method takes two Object parameters, one which is the object that the method should + * set its data inside of and one which is the new value to set. This is to be able to nicely support + * nested compound DataProviders. * * @param index the index into the data array * @param bufObject the data object @@ -1741,12 +1741,13 @@ public void setDataValue(int index, Object bufObject, Object newValue) { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Float.float16ToFloat((short) bufObject); + newbufObject = Float.float16ToFloat((short)bufObject); try { setDataValue(index, newbufObject, newValue); } catch (Exception ex) { - log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, newValue, ex); + log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, + newValue, ex); } log.trace("setDataValue({}, {})=({}): finish", index, newbufObject, newValue); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java index 150efedd..8107ffb4 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataValidatorFactory.java @@ -641,20 +641,22 @@ public boolean validate(int colIndex, int rowIndex, Object newValue) /* * First try to parse as a larger type in order to catch a NumberFormatException */ - Integer intValue = Integer.parseInt((String) newValue); + Integer intValue = Integer.parseInt((String)newValue); if (intValue < 0) - throw new NumberFormatException("Invalid negative value for unsigned datatype"); + throw new NumberFormatException( + "Invalid negative value for unsigned datatype"); if (intValue > (Short.MAX_VALUE * 2) + 1) - throw new NumberFormatException("Value out of range. Value:\"" + newValue + "\""); + throw new NumberFormatException("Value out of range. Value:\"" + newValue + + "\""); } else { - Short.parseShort((String) newValue); + Short.parseShort((String)newValue); } } else { /* Floating-point type */ - Float.parseFloat((String) newValue); + Float.parseFloat((String)newValue); } break; diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java index 0a463380..87ab28c3 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundAttributeDialog.java @@ -465,14 +465,15 @@ else if (DATATYPE_NAMES[10].equals(typeName)) { // enum } else if (DATATYPE_NAMES[11].equals(typeName)) { type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, - Datatype.SIGN_NONE); + Datatype.SIGN_NONE); } else if (DATATYPE_NAMES[12].equals(typeName)) { type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); } else if (DATATYPE_NAMES[13].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); } else { throw new IllegalArgumentException("Invalid data type."); diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java index 027c4d22..d2f40d8f 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewCompoundDatasetDialog.java @@ -865,14 +865,15 @@ else if (DATATYPE_NAMES[10].equals(typeName)) { // enum } else if (DATATYPE_NAMES[11].equals(typeName)) { type = fileFormat.createDatatype(Datatype.CLASS_INTEGER, 8, Datatype.NATIVE, - Datatype.SIGN_NONE); + Datatype.SIGN_NONE); } else if (DATATYPE_NAMES[12].equals(typeName)) { type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); } else if (DATATYPE_NAMES[13].equals(typeName)) { - type = fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); + type = + fileFormat.createDatatype(Datatype.CLASS_FLOAT, 16, Datatype.NATIVE, Datatype.NATIVE); } else { throw new IllegalArgumentException("Invalid data type."); diff --git a/src/org.hdfgroup.object/hdf/object/Dataset.java b/src/org.hdfgroup.object/hdf/object/Dataset.java index 57aed595..1afb649b 100644 --- a/src/org.hdfgroup.object/hdf/object/Dataset.java +++ b/src/org.hdfgroup.object/hdf/object/Dataset.java @@ -1598,7 +1598,7 @@ else if (theType.isFloat() && theType.getDatatypeSize() == 2) { if (value == null) strValue = "null"; else - strValue = Float.toString(Float.float16ToFloat((short) value)); + strValue = Float.toString(Float.float16ToFloat((short)value)); // if (count > 0 && strValue.length() > count) // truncate the extra characters @@ -1612,7 +1612,7 @@ else if (theType.isFloat() && theType.getDatatypeSize() == 2) { if (value == null) strValue = "null"; else - strValue = Float.toString(Float.float16ToFloat((short) value)); + strValue = Float.toString(Float.float16ToFloat((short)value)); if (count > 0 && strValue.length() > count) // truncate the extra characters diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java index 3ba04c0c..42255ad2 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java @@ -1423,8 +1423,8 @@ else if (datatypeOrder == Datatype.ORDER_LE) { else if (datatypeSize == 8) tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_DOUBLE); else - tid = H5.H5Tcopy( - (datatypeSize == 4) ? HDF5Constants.H5T_NATIVE_FLOAT : HDF5Constants.H5T_NATIVE_FLOAT16); + tid = H5.H5Tcopy((datatypeSize == 4) ? HDF5Constants.H5T_NATIVE_FLOAT + : HDF5Constants.H5T_NATIVE_FLOAT16); if (datatypeOrder == Datatype.ORDER_BE) { H5.H5Tset_order(tid, HDF5Constants.H5T_ORDER_BE); diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java index e0eaafeb..66b2ea28 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java @@ -1052,7 +1052,7 @@ else if (dsDatatype.isArray() && dsDatatype.getDatatypeBase().isFloat() && } else if (dsDatatype.isRef() && (theData instanceof byte[])) { log.trace( - "scalarDatasetCommonIO():read ioType isRef: converting byte array to List of bytes"); + "scalarDatasetCommonIO():read ioType isRef: converting byte array to List of bytes"); ArrayList theListData = new ArrayList<>((int)totalSelectedSpacePoints); for (int m = 0; m < (int)totalSelectedSpacePoints; m++) { byte[] curBytes = new byte[(int)dsDatatype.getDatatypeSize()]; @@ -2387,9 +2387,9 @@ else if (datatypeSize == 8) else if (datatypeSize == 8) data = HDFNativeData.doubleToByte(valDbl); else if (datatypeSize == 4) - data = HDFNativeData.floatToByte((float) valDbl); + data = HDFNativeData.floatToByte((float)valDbl); else - data = HDFNativeData.shortToByte((short) Float.floatToFloat16((float) valDbl)); + data = HDFNativeData.shortToByte((short)Float.floatToFloat16((float)valDbl)); break; case Datatype.CLASS_STRING: log.trace("parseFillValue(): class CLASS_STRING"); From d4009991be9f6f29109db7a6dd84be7f96c796ba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 25 Apr 2024 17:15:11 -0500 Subject: [PATCH 03/16] StringAttribute dialog is used for non-HDF5 attributes --- .../view/dialog/NewStringAttributeDialog.java | 38 +------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java index 68132a75..c9dcc07d 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java @@ -55,7 +55,7 @@ import org.eclipse.swt.widgets.Text; /** - * NewStringAttributeDialog displays components for adding a new attribute. + * NewStringAttributeDialog displays components for adding a new attribute, not used for HDF5. * * @author Jordan T. Henderson * @version 2.4 1/7/2016 @@ -542,24 +542,7 @@ else if (tsize == 8) { } if (tclass == Datatype.CLASS_FLOAT) { - if ((tsize == 2)) { - float[] f = new float[arraySize]; - for (int j = 0; j < count; j++) { - theToken = st.nextToken().trim(); - try { - f[j] = Float.parseFloat(theToken); - } - catch (NumberFormatException ex) { - Tools.showError(shell, "Create", ex.getMessage()); - return false; - } - if (Float.isInfinite(f[j]) || Float.isNaN(f[j])) { - f[j] = 0; - } - } - value = f; - } - else if ((tsize == 4) || (tsize == -1)) { + if ((tsize == 4) || (tsize == -1)) { float[] f = new float[arraySize]; for (int j = 0; j < count; j++) { theToken = st.nextToken().trim(); @@ -593,23 +576,6 @@ else if (tsize == 8) { } value = d; } - else if (tsize == 16) { - double[] d = new double[arraySize]; - for (int j = 0; j < count; j++) { - theToken = st.nextToken().trim(); - try { - d[j] = Double.parseDouble(theToken); - } - catch (NumberFormatException ex) { - Tools.showError(shell, "Create", ex.getMessage()); - return false; - } - if (Double.isInfinite(d[j]) || Double.isNaN(d[j])) { - d[j] = 0; - } - } - value = d; - } } } From af49dd30f81f21057c02b9c71d168113ffd3eba7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Apr 2024 13:24:36 -0500 Subject: [PATCH 04/16] Add float16 test and fix dataDisplay --- build.xml | 12 +- .../DataDisplayConverterFactory.java | 9 +- .../view/TableView/DataProviderFactory.java | 6 +- .../uitest/TestAll.java | 2 +- .../uitest/TestHDFViewFloat16.java | 212 ++++++++++++++++++ .../misc/DebugHDF.java | 12 +- 6 files changed, 236 insertions(+), 17 deletions(-) create mode 100644 test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java diff --git a/build.xml b/build.xml index 4ff03935..9f43b3ce 100644 --- a/build.xml +++ b/build.xml @@ -831,11 +831,11 @@ - + Date: Fri, 26 Apr 2024 18:25:11 +0000 Subject: [PATCH 05/16] Committing clang-format changes --- .../DataDisplayConverterFactory.java | 4 +- .../view/TableView/DataProviderFactory.java | 8 +- .../uitest/TestAll.java | 2 +- .../uitest/TestHDFViewFloat16.java | 171 +++++++++--------- .../misc/DebugHDF.java | 13 +- 5 files changed, 97 insertions(+), 101 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java index 5d61e55f..333fd591 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java @@ -762,14 +762,14 @@ else if (showAsBin) { else if (numberFormat != null) { log.trace("canonicalToDisplayValue({}): numberFormat", value); if (isFLT16) - buffer.append(numberFormat.format((float) value)); + buffer.append(numberFormat.format((float)value)); else buffer.append(numberFormat.format(value)); } else { log.trace("canonicalToDisplayValue({}): else", value); if (isFLT16) - buffer.append(Float.toString((float) value)); + buffer.append(Float.toString((float)value)); else buffer.append(value.toString()); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 0c796822..cb596a57 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1644,8 +1644,8 @@ public Object getDataValue(int columnIndex, int rowIndex) try { if (isFLT16) -// theValue = Float.toString(Float.float16ToFloat((short)theValue)); - theValue = Float.float16ToFloat((short) theValue); + // theValue = Float.toString(Float.float16ToFloat((short)theValue)); + theValue = Float.float16ToFloat((short)theValue); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } @@ -1666,8 +1666,8 @@ public Object getDataValue(Object obj, int index) try { if (isFLT16) -// theValue = Float.toString(Float.float16ToFloat((short)theValue)); - theValue = Float.float16ToFloat((short) theValue); + // theValue = Float.toString(Float.float16ToFloat((short)theValue)); + theValue = Float.float16ToFloat((short)theValue); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); } diff --git a/test/org.hdfgroup.hdfview.test/uitest/TestAll.java b/test/org.hdfgroup.hdfview.test/uitest/TestAll.java index cbb9862a..d7221617 100644 --- a/test/org.hdfgroup.hdfview.test/uitest/TestAll.java +++ b/test/org.hdfgroup.hdfview.test/uitest/TestAll.java @@ -9,7 +9,7 @@ TestHDFViewAttributes.class, TestHDFViewImageConversion.class, TestTreeViewFiles.class, TestTreeViewFilters.class, TestHDFViewIntConversions.class, TestTreeViewNewMenu.class, TestTreeViewExport.class, TestHDFViewTAttr2.class, TestTreeViewNewVLDatatypes.class, - TestHDFViewRefs.class, TestHDFViewFloat16.class }) + TestHDFViewRefs.class, TestHDFViewFloat16.class}) public class TestAll { } diff --git a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java index b5531a68..aa04d07e 100644 --- a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java +++ b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java @@ -32,48 +32,43 @@ public class TestHDFViewFloat16 extends AbstractWindowTest { @Test public void checkHDF5DS16BITS() { - String[][] expectedData = { - { "16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", - "7.0", "7.5" }, - { "15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", - "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625" }, - { "14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", - "5.625", "6.125", "6.625", "7.125", "7.625" }, - { "13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", - "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875" }, - { "12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", - "6.25", - "6.75", "7.25", "7.75" }, - { "11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", - "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125" }, - { "10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", - "5.875", "6.375", "6.875", "7.375", "7.875" }, - { "9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", - "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375" } }; + String[][] expectedData = { + {"16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", + "6.5", "7.0", "7.5"}, + {"15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", + "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625"}, + {"14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", + "5.625", "6.125", "6.625", "7.125", "7.625"}, + {"13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", + "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875"}, + {"12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", + "6.25", "6.75", "7.25", "7.75"}, + {"11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", + "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125"}, + {"10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", + "5.875", "6.375", "6.875", "7.375", "7.875"}, + {"9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", + "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375"}}; String[][] expectedDataSci = { - { "1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", "5.0E0", - "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0" }, - { "1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", - "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", - "7.5625E0" }, - { "1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", - "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0" }, - { "1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", - "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", - "7.6875E0" }, - { "1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", "4.75E0", - "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0" }, - { "1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", - "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", - "7.8125E0" }, - { "1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", - "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0" }, - { "9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", - "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", - "7.9375E0" } }; + {"1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", + "5.0E0", "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0"}, + {"1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", + "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", "7.5625E0"}, + {"1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", + "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0"}, + {"1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", + "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", "7.6875E0"}, + {"1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", + "4.75E0", "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0"}, + {"1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", + "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", "7.8125E0"}, + {"1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", + "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0"}, + {"9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", + "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", "7.9375E0"}}; SWTBotShell tableShell = null; - final String filename = "tfloat16.h5"; - final String datasetName = "/DS16BITS"; + final String filename = "tfloat16.h5"; + final String datasetName = "/DS16BITS"; File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); try { @@ -86,7 +81,7 @@ public void checkHDF5DS16BITS() final SWTBotNatTable dataTable = getNatTable(tableShell); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); retriever.testAllTableLocations(expectedData); @@ -116,52 +111,51 @@ public void checkHDF5DS16BITS() @Test public void checkHDF5AttrDS16BITS() { - String[][] expectedAttrData = { { "DS16BITS", "16-bit floating-point", "128", - "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875" } }; - String[][] expectedData = { - { "16.0" }, { "0.5" }, { "1.0" }, { "1.5" }, { "2.0" }, { "2.5" }, { "3.0" }, { "3.5" }, { "4.0" }, - { "4.5" }, { "5.0" }, { "5.5" }, { "6.0" }, { "6.5" }, { "7.0" }, { "7.5" }, { "15.0" }, { "0.5625" }, - { "1.0625" }, { "1.5625" }, { "2.0625" }, { "2.5625" }, { "3.0625" }, { "3.5625" }, { "4.0625" }, - { "4.5625" }, { "5.0625" }, { "5.5625" }, { "6.0625" }, { "6.5625" }, { "7.0625" }, { "7.5625" }, - { "14.0" }, { "0.625" }, { "1.125" }, { "1.625" }, { "2.125" }, { "2.625" }, { "3.125" }, { "3.625" }, - { "4.125" }, { "4.625" }, { "5.125" }, { "5.625" }, { "6.125" }, { "6.625" }, { "7.125" }, { "7.625" }, - { "13.0" }, { "0.6875" }, { "1.1875" }, { "1.6875" }, { "2.1875" }, { "2.6875" }, { "3.1875" }, - { "3.6875" }, { "4.1875" }, { "4.6875" }, { "5.1875" }, { "5.6875" }, { "6.1875" }, { "6.6875" }, - { "7.1875" }, { "7.6875" }, { "12.0" }, { "0.75" }, { "1.25" }, { "1.75" }, { "2.25" }, { "2.75" }, - { "3.25" }, { "3.75" }, { "4.25" }, { "4.75" }, { "5.25" }, { "5.75" }, { "6.25" }, { "6.75" }, - { "7.25" }, { "7.75" }, { "11.0" }, { "0.8125" }, { "1.3125" }, { "1.8125" }, { "2.3125" }, - { "2.8125" }, { "3.3125" }, { "3.8125" }, { "4.3125" }, { "4.8125" }, { "5.3125" }, { "5.8125" }, - { "6.3125" }, { "6.8125" }, { "7.3125" }, { "7.8125" }, { "10.0" }, { "0.875" }, { "1.375" }, - { "1.875" }, { "2.375" }, { "2.875" }, { "3.375" }, { "3.875" }, { "4.375" }, { "4.875" }, { "5.375" }, - { "5.875" }, { "6.375" }, { "6.875" }, { "7.375" }, { "7.875" }, { "9.0" }, { "0.9375" }, { "1.4375" }, - { "1.9375" }, { "2.4375" }, { "2.9375" }, { "3.4375" }, { "3.9375" }, { "4.4375" }, { "4.9375" }, - { "5.4375" }, { "5.9375" }, { "6.4375" }, { "6.9375" }, { "7.4375" }, { "7.9375" } }; + String[][] expectedAttrData = { + {"DS16BITS", "16-bit floating-point", "128", + "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875"}}; + String[][] expectedData = { + {"16.0"}, {"0.5"}, {"1.0"}, {"1.5"}, {"2.0"}, {"2.5"}, {"3.0"}, {"3.5"}, + {"4.0"}, {"4.5"}, {"5.0"}, {"5.5"}, {"6.0"}, {"6.5"}, {"7.0"}, {"7.5"}, + {"15.0"}, {"0.5625"}, {"1.0625"}, {"1.5625"}, {"2.0625"}, {"2.5625"}, {"3.0625"}, {"3.5625"}, + {"4.0625"}, {"4.5625"}, {"5.0625"}, {"5.5625"}, {"6.0625"}, {"6.5625"}, {"7.0625"}, {"7.5625"}, + {"14.0"}, {"0.625"}, {"1.125"}, {"1.625"}, {"2.125"}, {"2.625"}, {"3.125"}, {"3.625"}, + {"4.125"}, {"4.625"}, {"5.125"}, {"5.625"}, {"6.125"}, {"6.625"}, {"7.125"}, {"7.625"}, + {"13.0"}, {"0.6875"}, {"1.1875"}, {"1.6875"}, {"2.1875"}, {"2.6875"}, {"3.1875"}, {"3.6875"}, + {"4.1875"}, {"4.6875"}, {"5.1875"}, {"5.6875"}, {"6.1875"}, {"6.6875"}, {"7.1875"}, {"7.6875"}, + {"12.0"}, {"0.75"}, {"1.25"}, {"1.75"}, {"2.25"}, {"2.75"}, {"3.25"}, {"3.75"}, + {"4.25"}, {"4.75"}, {"5.25"}, {"5.75"}, {"6.25"}, {"6.75"}, {"7.25"}, {"7.75"}, + {"11.0"}, {"0.8125"}, {"1.3125"}, {"1.8125"}, {"2.3125"}, {"2.8125"}, {"3.3125"}, {"3.8125"}, + {"4.3125"}, {"4.8125"}, {"5.3125"}, {"5.8125"}, {"6.3125"}, {"6.8125"}, {"7.3125"}, {"7.8125"}, + {"10.0"}, {"0.875"}, {"1.375"}, {"1.875"}, {"2.375"}, {"2.875"}, {"3.375"}, {"3.875"}, + {"4.375"}, {"4.875"}, {"5.375"}, {"5.875"}, {"6.375"}, {"6.875"}, {"7.375"}, {"7.875"}, + {"9.0"}, {"0.9375"}, {"1.4375"}, {"1.9375"}, {"2.4375"}, {"2.9375"}, {"3.4375"}, {"3.9375"}, + {"4.4375"}, {"4.9375"}, {"5.4375"}, {"5.9375"}, {"6.4375"}, {"6.9375"}, {"7.4375"}, {"7.9375"}}; String[][] expectedDataSci = { - { "1.6E1" }, { "5.0E-1" }, { "1.0E0" }, { "1.5E0" }, { "2.0E0" }, { "2.5E0" }, { "3.0E0" }, { "3.5E0" }, - { "4.0E0" }, { "4.5E0" }, { "5.0E0" }, { "5.5E0" }, { "6.0E0" }, { "6.5E0" }, { "7.0E0" }, { "7.5E0" }, - { "1.5E1" }, { "5.625E-1" }, { "1.0625E0" }, { "1.5625E0" }, { "2.0625E0" }, { "2.5625E0" }, - { "3.0625E0" }, { "3.5625E0" }, { "4.0625E0" }, { "4.5625E0" }, { "5.0625E0" }, { "5.5625E0" }, - { "6.0625E0" }, { "6.5625E0" }, { "7.0625E0" }, { "7.5625E0" }, { "1.4E1" }, { "6.25E-1" }, - { "1.125E0" }, { "1.625E0" }, { "2.125E0" }, { "2.625E0" }, { "3.125E0" }, { "3.625E0" }, { "4.125E0" }, - { "4.625E0" }, { "5.125E0" }, { "5.625E0" }, { "6.125E0" }, { "6.625E0" }, { "7.125E0" }, { "7.625E0" }, - { "1.3E1" }, { "6.875E-1" }, { "1.1875E0" }, { "1.6875E0" }, { "2.1875E0" }, { "2.6875E0" }, - { "3.1875E0" }, { "3.6875E0" }, { "4.1875E0" }, { "4.6875E0" }, { "5.1875E0" }, { "5.6875E0" }, - { "6.1875E0" }, { "6.6875E0" }, { "7.1875E0" }, { "7.6875E0" }, { "1.2E1" }, { "7.5E-1" }, { "1.25E0" }, - { "1.75E0" }, { "2.25E0" }, { "2.75E0" }, { "3.25E0" }, { "3.75E0" }, { "4.25E0" }, { "4.75E0" }, - { "5.25E0" }, { "5.75E0" }, { "6.25E0" }, { "6.75E0" }, { "7.25E0" }, { "7.75E0" }, { "1.1E1" }, - { "8.125E-1" }, { "1.3125E0" }, { "1.8125E0" }, { "2.3125E0" }, { "2.8125E0" }, { "3.3125E0" }, - { "3.8125E0" }, { "4.3125E0" }, { "4.8125E0" }, { "5.3125E0" }, { "5.8125E0" }, { "6.3125E0" }, - { "6.8125E0" }, { "7.3125E0" }, { "7.8125E0" }, { "1.0E1" }, { "8.75E-1" }, { "1.375E0" }, - { "1.875E0" }, { "2.375E0" }, { "2.875E0" }, { "3.375E0" }, { "3.875E0" }, { "4.375E0" }, { "4.875E0" }, - { "5.375E0" }, { "5.875E0" }, { "6.375E0" }, { "6.875E0" }, { "7.375E0" }, { "7.875E0" }, { "9.0E0" }, - { "9.375E-1" }, { "1.4375E0" }, { "1.9375E0" }, { "2.4375E0" }, { "2.9375E0" }, { "3.4375E0" }, - { "3.9375E0" }, { "4.4375E0" }, { "4.9375E0" }, { "5.4375E0" }, { "5.9375E0" }, { "6.4375E0" }, - { "6.9375E0" }, { "7.4375E0" }, { "7.9375E0" } }; + {"1.6E1"}, {"5.0E-1"}, {"1.0E0"}, {"1.5E0"}, {"2.0E0"}, {"2.5E0"}, {"3.0E0"}, + {"3.5E0"}, {"4.0E0"}, {"4.5E0"}, {"5.0E0"}, {"5.5E0"}, {"6.0E0"}, {"6.5E0"}, + {"7.0E0"}, {"7.5E0"}, {"1.5E1"}, {"5.625E-1"}, {"1.0625E0"}, {"1.5625E0"}, {"2.0625E0"}, + {"2.5625E0"}, {"3.0625E0"}, {"3.5625E0"}, {"4.0625E0"}, {"4.5625E0"}, {"5.0625E0"}, {"5.5625E0"}, + {"6.0625E0"}, {"6.5625E0"}, {"7.0625E0"}, {"7.5625E0"}, {"1.4E1"}, {"6.25E-1"}, {"1.125E0"}, + {"1.625E0"}, {"2.125E0"}, {"2.625E0"}, {"3.125E0"}, {"3.625E0"}, {"4.125E0"}, {"4.625E0"}, + {"5.125E0"}, {"5.625E0"}, {"6.125E0"}, {"6.625E0"}, {"7.125E0"}, {"7.625E0"}, {"1.3E1"}, + {"6.875E-1"}, {"1.1875E0"}, {"1.6875E0"}, {"2.1875E0"}, {"2.6875E0"}, {"3.1875E0"}, {"3.6875E0"}, + {"4.1875E0"}, {"4.6875E0"}, {"5.1875E0"}, {"5.6875E0"}, {"6.1875E0"}, {"6.6875E0"}, {"7.1875E0"}, + {"7.6875E0"}, {"1.2E1"}, {"7.5E-1"}, {"1.25E0"}, {"1.75E0"}, {"2.25E0"}, {"2.75E0"}, + {"3.25E0"}, {"3.75E0"}, {"4.25E0"}, {"4.75E0"}, {"5.25E0"}, {"5.75E0"}, {"6.25E0"}, + {"6.75E0"}, {"7.25E0"}, {"7.75E0"}, {"1.1E1"}, {"8.125E-1"}, {"1.3125E0"}, {"1.8125E0"}, + {"2.3125E0"}, {"2.8125E0"}, {"3.3125E0"}, {"3.8125E0"}, {"4.3125E0"}, {"4.8125E0"}, {"5.3125E0"}, + {"5.8125E0"}, {"6.3125E0"}, {"6.8125E0"}, {"7.3125E0"}, {"7.8125E0"}, {"1.0E1"}, {"8.75E-1"}, + {"1.375E0"}, {"1.875E0"}, {"2.375E0"}, {"2.875E0"}, {"3.375E0"}, {"3.875E0"}, {"4.375E0"}, + {"4.875E0"}, {"5.375E0"}, {"5.875E0"}, {"6.375E0"}, {"6.875E0"}, {"7.375E0"}, {"7.875E0"}, + {"9.0E0"}, {"9.375E-1"}, {"1.4375E0"}, {"1.9375E0"}, {"2.4375E0"}, {"2.9375E0"}, {"3.4375E0"}, + {"3.9375E0"}, {"4.4375E0"}, {"4.9375E0"}, {"5.4375E0"}, {"5.9375E0"}, {"6.4375E0"}, {"6.9375E0"}, + {"7.4375E0"}, {"7.9375E0"}}; SWTBotShell tableShell = null; - String filename = "tfloat16.h5"; - String datasetName = "/DS16BITS"; - String attributeName = "DS16BITS"; - File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); + String filename = "tfloat16.h5"; + String datasetName = "/DS16BITS"; + String attributeName = "DS16BITS"; + File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); try { SWTBotTree filetree = bot.tree(); @@ -172,15 +166,16 @@ public void checkHDF5AttrDS16BITS() SWTBotTable attrTable = openAttributeTable(filetree, filename, datasetName); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedAttrData); // Open attribute 1D - tableShell = openAttributeObject(attrTable, attributeName, 0); + tableShell = openAttributeObject(attrTable, attributeName, 0); SWTBotNatTable dataTable = getNatTable(tableShell); - retriever = DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); + retriever = + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedData); diff --git a/test/org.hdfgroup.object.test/misc/DebugHDF.java b/test/org.hdfgroup.object.test/misc/DebugHDF.java index c428ed21..061300c1 100644 --- a/test/org.hdfgroup.object.test/misc/DebugHDF.java +++ b/test/org.hdfgroup.object.test/misc/DebugHDF.java @@ -1147,8 +1147,8 @@ private static final void createINF(String fname) throws Exception dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE); testFile.createScalarDS("f64", root, dtype, dims2D, null, null, 0, data2); -// dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); -// testFile.createScalarDS("f16", root, dtype, dims2D, null, null, 0, data2); + // dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + // testFile.createScalarDS("f16", root, dtype, dims2D, null, null, 0, data2); testFile.close(); } @@ -3384,8 +3384,8 @@ private static void createDataset(final String fname) throws Exception testFile.createScalarDS("3D float", g2, dtype, dims3D, null, null, 0, null); // create 3D 16-bit (2 bytes) float16 dataset of 20 by 10 by 5 -// dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); -// testFile.createScalarDS("3D float16", g2, dtype, dims3Dh, null, null, 0, null); + // dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + // testFile.createScalarDS("3D float16", g2, dtype, dims3Dh, null, null, 0, null); // close file resource testFile.close(); @@ -3443,8 +3443,9 @@ private static void createStrDataset(final String fname) throws Exception testFile.createScalarDS("3D 32-bit float 20x10x5", g2, dtype, dims3D, null, null, 0, null); // Create 3D 16-bit (2 bytes) float dataset of 20 by 10 by 5 -// dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); -// testFile.createScalarDS("3D 16-bit float16 20x10x5", g2, dtype, dims3Dh, null, null, 0, null); + // dtype = testFile.createDatatype(Datatype.CLASS_FLOAT, 2, Datatype.NATIVE, Datatype.NATIVE); + // testFile.createScalarDS("3D 16-bit float16 20x10x5", g2, dtype, dims3Dh, null, null, 0, + // null); // Create String dataset System.out.println("Just before call for STRINGS"); From 7ab8c4d640d2ce76a23108386213e59351165824 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Apr 2024 14:44:31 -0500 Subject: [PATCH 06/16] Fix comments and use same float16 conversion method --- .../view/TableView/DataProviderFactory.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index cb596a57..daf1ca6a 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1682,7 +1682,7 @@ else if (isUINT64) } /** - * update the data value of a compound type. + * update the data value of a type. * * @param columnIndex the column * @param rowIndex the row @@ -1693,22 +1693,12 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) { Object theValue = newValue; if (isFLT16) - theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); + theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); super.setDataValue(columnIndex, rowIndex, theValue); } /** - * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or - * when a top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a - * base CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and - * row index. This method is for facilitating this behavior. - * - * In general, all "container" DataProviders that have a "container" base DataProvider should call - * down into their base DataProvider(s) using this{}, method, in order to ensure that buried - * CompoundDataProviders get handled correctly. When their base DataProvider is not a "container" - * type, the method setDataValue(index, Object, Object) should be used instead. - * * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, * Object, Object) using the passed rowIndex. However, this method should, in general, not be called * by atomic type DataProviders. @@ -1722,7 +1712,7 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Float.float16ToFloat((short)bufObject); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); setDataValue(rowIndex, newbufObject, newValue); } @@ -1743,7 +1733,7 @@ public void setDataValue(int index, Object bufObject, Object newValue) { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Float.float16ToFloat((short)bufObject); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); try { setDataValue(index, newbufObject, newValue); } From 3fd3303b8b2c52a3395cefc4b3edae155fd5e530 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Apr 2024 14:49:22 -0500 Subject: [PATCH 07/16] Correct merge issues --- .../view/TableView/DataDisplayConverterFactory.java | 12 ++---------- .../hdf/view/TableView/DataProviderFactory.java | 2 -- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java index 333fd591..39bcc84f 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataDisplayConverterFactory.java @@ -760,18 +760,10 @@ else if (showAsBin) { buffer.append(Tools.toBinaryString(Long.valueOf(value.toString()), (int)typeSize)); } else if (numberFormat != null) { - log.trace("canonicalToDisplayValue({}): numberFormat", value); - if (isFLT16) - buffer.append(numberFormat.format((float)value)); - else - buffer.append(numberFormat.format(value)); + buffer.append(numberFormat.format(value)); } else { - log.trace("canonicalToDisplayValue({}): else", value); - if (isFLT16) - buffer.append(Float.toString((float)value)); - else - buffer.append(value.toString()); + buffer.append(value.toString()); } } catch (Exception ex) { diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index daf1ca6a..97026117 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1644,7 +1644,6 @@ public Object getDataValue(int columnIndex, int rowIndex) try { if (isFLT16) - // theValue = Float.toString(Float.float16ToFloat((short)theValue)); theValue = Float.float16ToFloat((short)theValue); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); @@ -1666,7 +1665,6 @@ public Object getDataValue(Object obj, int index) try { if (isFLT16) - // theValue = Float.toString(Float.float16ToFloat((short)theValue)); theValue = Float.float16ToFloat((short)theValue); else if (isUINT64) theValue = Tools.convertUINT64toBigInt(Long.valueOf((long)theValue)); From 4d65adc10a34b6c3bb27423ef95d98409a00ad6e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 19:49:55 +0000 Subject: [PATCH 08/16] Committing clang-format changes --- .../hdf/view/TableView/DataProviderFactory.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 97026117..1ba95970 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1691,7 +1691,7 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) { Object theValue = newValue; if (isFLT16) - theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); super.setDataValue(columnIndex, rowIndex, theValue); } @@ -1710,7 +1710,7 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); setDataValue(rowIndex, newbufObject, newValue); } @@ -1731,7 +1731,7 @@ public void setDataValue(int index, Object bufObject, Object newValue) { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); try { setDataValue(index, newbufObject, newValue); } From 06b420bcc1881c689d538e8d7e162bcdca7fa274 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Apr 2024 14:53:50 -0500 Subject: [PATCH 09/16] Comment edit --- .../view/TableView/DataProviderFactory.java | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 1ba95970..81be4611 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -376,30 +376,24 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) } /** - * When a CompoundDataProvider wants to pass a List of data down to a nested - * CompoundDataProvider, or when a top-level container DataProvider (such as an - * ArrayDataProvider) wants to hand data down to a base CompoundDataProvider, we - * need to pass down a List of data and the new value, plus a field and row - * index. This method is for facilitating this behavior. + * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or when a + * top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a base + * CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and row index. This + * method is for facilitating this behavior. * - * In general, all "container" DataProviders that have a "container" base - * DataProvider should call down into their base DataProvider(s) using this{}, - * method, in order to ensure that buried CompoundDataProviders get handled - * correctly. When their base DataProvider is not a "container" type, the method - * setDataValue(index, Object, Object) should be used instead. + * In general, all "container" DataProviders that have a "container" base DataProvider should call down into + * their base DataProvider(s) using this, method, in order to ensure that buried CompoundDataProviders get + * handled correctly. When their base DataProvider is not a "container" type, the method setDataValue(index, + * Object, Object) should be used instead. * - * For atomic type DataProviders, we treat this method as directly calling into - * setDataValue(index, Object, Object) using the passed rowIndex. However, this - * method should, in general, not be called by atomic type DataProviders. + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, + * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type + * DataProviders. * - * @param columnIndex - * the column - * @param rowIndex - * the row - * @param bufObject - * the data object - * @param newValue - * the new data object + * @param columnIndex the column + * @param rowIndex the row + * @param bufObject the data object + * @param newValue the new data object */ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object newValue) { From eba8d7c94886086706cc6900866e969b7c134d89 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 19:54:46 +0000 Subject: [PATCH 10/16] Committing clang-format changes --- .../view/TableView/DataProviderFactory.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 81be4611..3470f8c2 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -376,19 +376,19 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) } /** - * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or when a - * top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a base - * CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and row index. This - * method is for facilitating this behavior. + * When a CompoundDataProvider wants to pass a List of data down to a nested CompoundDataProvider, or + * when a top-level container DataProvider (such as an ArrayDataProvider) wants to hand data down to a + * base CompoundDataProvider, we need to pass down a List of data and the new value, plus a field and + * row index. This method is for facilitating this behavior. * - * In general, all "container" DataProviders that have a "container" base DataProvider should call down into - * their base DataProvider(s) using this, method, in order to ensure that buried CompoundDataProviders get - * handled correctly. When their base DataProvider is not a "container" type, the method setDataValue(index, - * Object, Object) should be used instead. + * In general, all "container" DataProviders that have a "container" base DataProvider should call + * down into their base DataProvider(s) using this, method, in order to ensure that buried + * CompoundDataProviders get handled correctly. When their base DataProvider is not a "container" + * type, the method setDataValue(index, Object, Object) should be used instead. * - * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, - * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type - * DataProviders. + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, + * Object, Object) using the passed rowIndex. However, this method should, in general, not be called + * by atomic type DataProviders. * * @param columnIndex the column * @param rowIndex the row From 0ca1e571b0ff6953633fff2d9ab36879fd099cbc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 27 Apr 2024 10:30:54 -0500 Subject: [PATCH 11/16] Call setValue() up the stack --- .../view/TableView/DataProviderFactory.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 3470f8c2..37a5b476 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1691,9 +1691,9 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) } /** - * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, - * Object, Object) using the passed rowIndex. However, this method should, in general, not be called - * by atomic type DataProviders. + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, + * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type + * DataProviders. * * @param columnIndex the column * @param rowIndex the row @@ -1704,18 +1704,18 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); - setDataValue(rowIndex, newbufObject, newValue); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + super.setDataValue(rowIndex, newbufObject, newValue); } /** - * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing - * the operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the - * direct index to have the base provider use. This method is to facilitate this kind of behavior. + * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing the + * operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the direct index + * to have the base provider use. This method is to facilitate this kind of behavior. * - * Note that this method takes two Object parameters, one which is the object that the method should - * set its data inside of and one which is the new value to set. This is to be able to nicely support - * nested compound DataProviders. + * Note that this method takes two Object parameters, one which is the object that the method should set its + * data inside of and one which is the new value to set. This is to be able to nicely support nested compound + * DataProviders. * * @param index the index into the data array * @param bufObject the data object @@ -1725,13 +1725,12 @@ public void setDataValue(int index, Object bufObject, Object newValue) { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); try { - setDataValue(index, newbufObject, newValue); + super.setDataValue(index, newbufObject, newValue); } catch (Exception ex) { - log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, - newValue, ex); + log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, newValue, ex); } log.trace("setDataValue({}, {})=({}): finish", index, newbufObject, newValue); } From 68ddb7c35ef83e9e023f6e1ae6479ab41f42651a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 27 Apr 2024 15:32:59 +0000 Subject: [PATCH 12/16] Committing clang-format changes --- .../view/TableView/DataProviderFactory.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 37a5b476..579736ed 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1691,9 +1691,9 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) } /** - * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, Object, - * Object) using the passed rowIndex. However, this method should, in general, not be called by atomic type - * DataProviders. + * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, + * Object, Object) using the passed rowIndex. However, this method should, in general, not be called + * by atomic type DataProviders. * * @param columnIndex the column * @param rowIndex the row @@ -1704,18 +1704,18 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); super.setDataValue(rowIndex, newbufObject, newValue); } /** - * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing the - * operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the direct index - * to have the base provider use. This method is to facilitate this kind of behavior. + * When a parent HDFDataProvider (such as an ArrayDataProvider) wants to set a data value by routing + * the operation through its base HDFDataProvider, the parent HDFDataProvider will generally know the + * direct index to have the base provider use. This method is to facilitate this kind of behavior. * - * Note that this method takes two Object parameters, one which is the object that the method should set its - * data inside of and one which is the new value to set. This is to be able to nicely support nested compound - * DataProviders. + * Note that this method takes two Object parameters, one which is the object that the method should + * set its data inside of and one which is the new value to set. This is to be able to nicely support + * nested compound DataProviders. * * @param index the index into the data array * @param bufObject the data object @@ -1725,12 +1725,13 @@ public void setDataValue(int index, Object bufObject, Object newValue) { Object newbufObject = bufObject; if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String) newValue))); + newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); try { super.setDataValue(index, newbufObject, newValue); } catch (Exception ex) { - log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, newValue, ex); + log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, + newValue, ex); } log.trace("setDataValue({}, {})=({}): finish", index, newbufObject, newValue); } From 94b691f4954db183eec77ad31f26123d6a844578 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 May 2024 10:46:04 -0500 Subject: [PATCH 13/16] seDataValue requires the newValue Object to be a string --- .../view/TableView/DataProviderFactory.java | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 579736ed..a2550023 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1683,29 +1683,23 @@ else if (isUINT64) @Override public void setDataValue(int columnIndex, int rowIndex, Object newValue) { - Object theValue = newValue; - if (isFLT16) - theValue = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); - - super.setDataValue(columnIndex, rowIndex, theValue); - } - - /** - * For atomic type DataProviders, we treat this method as directly calling into setDataValue(index, - * Object, Object) using the passed rowIndex. However, this method should, in general, not be called - * by atomic type DataProviders. - * - * @param columnIndex the column - * @param rowIndex the row - * @param bufObject the data object - * @param newValue the new data object - */ - public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object newValue) - { - Object newbufObject = bufObject; - if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); - super.setDataValue(rowIndex, newbufObject, newValue); + log.trace("setDataValue({}, {})=({}): start", rowIndex, columnIndex, newValue); + try { + if (isFLT16) { + // must convert string from float to short first + float fValue = Float.parseFloat((String) newValue); + short sValue = Float.floatToFloat16(fValue); + // setDataValue requires a String, so convert short to String + String strValue = Short.toString(sValue); + super.setDataValue(columnIndex, rowIndex, strValue); + } + else + super.setDataValue(columnIndex, rowIndex, newValue); + } + catch (Exception ex) { + log.debug("setDataValue({}, {})=({}): failure: ", rowIndex, columnIndex, newValue, ex); + theValue = DataFactoryUtils.errStr; + } } /** @@ -1723,17 +1717,24 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object */ public void setDataValue(int index, Object bufObject, Object newValue) { - Object newbufObject = bufObject; - if (isFLT16) - newbufObject = Short.toString(Float.floatToFloat16(Float.parseFloat((String)newValue))); + log.trace("setDataValue({}: {})=({}): start", index, bufObject, newValue); try { - super.setDataValue(index, newbufObject, newValue); + if (isFLT16) { + // must convert string from float to short first + float fValue = Float.parseFloat((String) newValue); + short sValue = Float.floatToFloat16(fValue); + // setDataValue requires a String, so convert short to String + String strValue = Short.toString(sValue); + super.setDataValue(index, bufObject, strValue); + } + else + super.setDataValue(index, bufObject, newValue); } catch (Exception ex) { - log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, newbufObject, + log.debug("setDataValue({}, {})=({}): updateAtomicValue failure: ", index, bufObject, newValue, ex); } - log.trace("setDataValue({}, {})=({}): finish", index, newbufObject, newValue); + log.trace("setDataValue({}, {})=({}): finish", index, bufObject, newValue); } } From 0f0d9bb4027a9517db57f9c840f273b115a8ed2f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 15:46:44 +0000 Subject: [PATCH 14/16] Committing clang-format changes --- .../hdf/view/TableView/DataProviderFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index a2550023..6edbd7bf 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1687,7 +1687,7 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue) try { if (isFLT16) { // must convert string from float to short first - float fValue = Float.parseFloat((String) newValue); + float fValue = Float.parseFloat((String)newValue); short sValue = Float.floatToFloat16(fValue); // setDataValue requires a String, so convert short to String String strValue = Short.toString(sValue); @@ -1721,7 +1721,7 @@ public void setDataValue(int index, Object bufObject, Object newValue) try { if (isFLT16) { // must convert string from float to short first - float fValue = Float.parseFloat((String) newValue); + float fValue = Float.parseFloat((String)newValue); short sValue = Float.floatToFloat16(fValue); // setDataValue requires a String, so convert short to String String strValue = Short.toString(sValue); From db4a74108c08344c0d864d489a2805bcf7360412 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 May 2024 14:56:10 -0500 Subject: [PATCH 15/16] Add tests for compound and array of float16 values --- .../uitest/TestHDFViewFloat16.java | 297 +++++++++++++----- .../uitest/tfloat16.h5 | Bin 2304 -> 4368 bytes 2 files changed, 223 insertions(+), 74 deletions(-) diff --git a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java index aa04d07e..16db7b10 100644 --- a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java +++ b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java @@ -33,39 +33,43 @@ public class TestHDFViewFloat16 extends AbstractWindowTest { public void checkHDF5DS16BITS() { String[][] expectedData = { - {"16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", - "6.5", "7.0", "7.5"}, - {"15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", - "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625"}, - {"14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", - "5.625", "6.125", "6.625", "7.125", "7.625"}, - {"13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", - "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875"}, - {"12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", - "6.25", "6.75", "7.25", "7.75"}, - {"11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", - "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125"}, - {"10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", - "5.875", "6.375", "6.875", "7.375", "7.875"}, - {"9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", - "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375"}}; + { "16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", + "7.0", "7.5" }, + { "15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", + "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625" }, + { "14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", + "5.625", "6.125", "6.625", "7.125", "7.625" }, + { "13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", + "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875" }, + { "12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", + "6.25", "6.75", "7.25", "7.75" }, + { "11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", + "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125" }, + { "10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", + "5.875", "6.375", "6.875", "7.375", "7.875" }, + { "9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", + "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375" } }; String[][] expectedDataSci = { - {"1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", - "5.0E0", "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0"}, - {"1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", - "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", "7.5625E0"}, - {"1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", - "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0"}, - {"1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", - "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", "7.6875E0"}, - {"1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", - "4.75E0", "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0"}, - {"1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", - "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", "7.8125E0"}, - {"1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", - "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0"}, - {"9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", - "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", "7.9375E0"}}; + { "1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", "5.0E0", + "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0" }, + { "1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", + "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", + "7.5625E0" }, + { "1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", + "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0" }, + { "1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", + "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", + "7.6875E0" }, + { "1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", "4.75E0", + "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0" }, + { "1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", + "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", + "7.8125E0" }, + { "1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", + "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0" }, + { "9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", + "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", + "7.9375E0" } }; SWTBotShell tableShell = null; final String filename = "tfloat16.h5"; final String datasetName = "/DS16BITS"; @@ -74,14 +78,14 @@ public void checkHDF5DS16BITS() try { SWTBotTree filetree = bot.tree(); - checkFileTree(filetree, "checkHDF5DS16BITS()", 2, filename); + checkFileTree(filetree, "checkHDF5DS16BITS()", 4, filename); // Open dataset 'DS08BITS' tableShell = openTreeviewObject(filetree, filename, datasetName); final SWTBotNatTable dataTable = getNatTable(tableShell); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); retriever.testAllTableLocations(expectedData); @@ -112,45 +116,47 @@ public void checkHDF5DS16BITS() public void checkHDF5AttrDS16BITS() { String[][] expectedAttrData = { - {"DS16BITS", "16-bit floating-point", "128", - "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875"}}; + { "DS16BITS", "16-bit floating-point", "128", + "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875" } }; String[][] expectedData = { - {"16.0"}, {"0.5"}, {"1.0"}, {"1.5"}, {"2.0"}, {"2.5"}, {"3.0"}, {"3.5"}, - {"4.0"}, {"4.5"}, {"5.0"}, {"5.5"}, {"6.0"}, {"6.5"}, {"7.0"}, {"7.5"}, - {"15.0"}, {"0.5625"}, {"1.0625"}, {"1.5625"}, {"2.0625"}, {"2.5625"}, {"3.0625"}, {"3.5625"}, - {"4.0625"}, {"4.5625"}, {"5.0625"}, {"5.5625"}, {"6.0625"}, {"6.5625"}, {"7.0625"}, {"7.5625"}, - {"14.0"}, {"0.625"}, {"1.125"}, {"1.625"}, {"2.125"}, {"2.625"}, {"3.125"}, {"3.625"}, - {"4.125"}, {"4.625"}, {"5.125"}, {"5.625"}, {"6.125"}, {"6.625"}, {"7.125"}, {"7.625"}, - {"13.0"}, {"0.6875"}, {"1.1875"}, {"1.6875"}, {"2.1875"}, {"2.6875"}, {"3.1875"}, {"3.6875"}, - {"4.1875"}, {"4.6875"}, {"5.1875"}, {"5.6875"}, {"6.1875"}, {"6.6875"}, {"7.1875"}, {"7.6875"}, - {"12.0"}, {"0.75"}, {"1.25"}, {"1.75"}, {"2.25"}, {"2.75"}, {"3.25"}, {"3.75"}, - {"4.25"}, {"4.75"}, {"5.25"}, {"5.75"}, {"6.25"}, {"6.75"}, {"7.25"}, {"7.75"}, - {"11.0"}, {"0.8125"}, {"1.3125"}, {"1.8125"}, {"2.3125"}, {"2.8125"}, {"3.3125"}, {"3.8125"}, - {"4.3125"}, {"4.8125"}, {"5.3125"}, {"5.8125"}, {"6.3125"}, {"6.8125"}, {"7.3125"}, {"7.8125"}, - {"10.0"}, {"0.875"}, {"1.375"}, {"1.875"}, {"2.375"}, {"2.875"}, {"3.375"}, {"3.875"}, - {"4.375"}, {"4.875"}, {"5.375"}, {"5.875"}, {"6.375"}, {"6.875"}, {"7.375"}, {"7.875"}, - {"9.0"}, {"0.9375"}, {"1.4375"}, {"1.9375"}, {"2.4375"}, {"2.9375"}, {"3.4375"}, {"3.9375"}, - {"4.4375"}, {"4.9375"}, {"5.4375"}, {"5.9375"}, {"6.4375"}, {"6.9375"}, {"7.4375"}, {"7.9375"}}; + { "16.0" }, { "0.5" }, { "1.0" }, { "1.5" }, { "2.0" }, { "2.5" }, { "3.0" }, { "3.5" }, { "4.0" }, + { "4.5" }, { "5.0" }, { "5.5" }, { "6.0" }, { "6.5" }, { "7.0" }, { "7.5" }, { "15.0" }, { "0.5625" }, + { "1.0625" }, { "1.5625" }, { "2.0625" }, { "2.5625" }, { "3.0625" }, { "3.5625" }, { "4.0625" }, + { "4.5625" }, { "5.0625" }, { "5.5625" }, { "6.0625" }, { "6.5625" }, { "7.0625" }, { "7.5625" }, + { "14.0" }, { "0.625" }, { "1.125" }, { "1.625" }, { "2.125" }, { "2.625" }, { "3.125" }, { "3.625" }, + { "4.125" }, { "4.625" }, { "5.125" }, { "5.625" }, { "6.125" }, { "6.625" }, { "7.125" }, { "7.625" }, + { "13.0" }, { "0.6875" }, { "1.1875" }, { "1.6875" }, { "2.1875" }, { "2.6875" }, { "3.1875" }, + { "3.6875" }, { "4.1875" }, { "4.6875" }, { "5.1875" }, { "5.6875" }, { "6.1875" }, { "6.6875" }, + { "7.1875" }, { "7.6875" }, { "12.0" }, { "0.75" }, { "1.25" }, { "1.75" }, { "2.25" }, { "2.75" }, + { "3.25" }, { "3.75" }, { "4.25" }, { "4.75" }, { "5.25" }, { "5.75" }, { "6.25" }, { "6.75" }, + { "7.25" }, { "7.75" }, { "11.0" }, { "0.8125" }, { "1.3125" }, { "1.8125" }, { "2.3125" }, + { "2.8125" }, { "3.3125" }, { "3.8125" }, { "4.3125" }, { "4.8125" }, { "5.3125" }, { "5.8125" }, + { "6.3125" }, { "6.8125" }, { "7.3125" }, { "7.8125" }, { "10.0" }, { "0.875" }, { "1.375" }, + { "1.875" }, { "2.375" }, { "2.875" }, { "3.375" }, { "3.875" }, { "4.375" }, { "4.875" }, { "5.375" }, + { "5.875" }, { "6.375" }, { "6.875" }, { "7.375" }, { "7.875" }, { "9.0" }, { "0.9375" }, { "1.4375" }, + { "1.9375" }, { "2.4375" }, { "2.9375" }, { "3.4375" }, { "3.9375" }, { "4.4375" }, { "4.9375" }, + { "5.4375" }, { "5.9375" }, { "6.4375" }, { "6.9375" }, { "7.4375" }, { "7.9375" } }; String[][] expectedDataSci = { - {"1.6E1"}, {"5.0E-1"}, {"1.0E0"}, {"1.5E0"}, {"2.0E0"}, {"2.5E0"}, {"3.0E0"}, - {"3.5E0"}, {"4.0E0"}, {"4.5E0"}, {"5.0E0"}, {"5.5E0"}, {"6.0E0"}, {"6.5E0"}, - {"7.0E0"}, {"7.5E0"}, {"1.5E1"}, {"5.625E-1"}, {"1.0625E0"}, {"1.5625E0"}, {"2.0625E0"}, - {"2.5625E0"}, {"3.0625E0"}, {"3.5625E0"}, {"4.0625E0"}, {"4.5625E0"}, {"5.0625E0"}, {"5.5625E0"}, - {"6.0625E0"}, {"6.5625E0"}, {"7.0625E0"}, {"7.5625E0"}, {"1.4E1"}, {"6.25E-1"}, {"1.125E0"}, - {"1.625E0"}, {"2.125E0"}, {"2.625E0"}, {"3.125E0"}, {"3.625E0"}, {"4.125E0"}, {"4.625E0"}, - {"5.125E0"}, {"5.625E0"}, {"6.125E0"}, {"6.625E0"}, {"7.125E0"}, {"7.625E0"}, {"1.3E1"}, - {"6.875E-1"}, {"1.1875E0"}, {"1.6875E0"}, {"2.1875E0"}, {"2.6875E0"}, {"3.1875E0"}, {"3.6875E0"}, - {"4.1875E0"}, {"4.6875E0"}, {"5.1875E0"}, {"5.6875E0"}, {"6.1875E0"}, {"6.6875E0"}, {"7.1875E0"}, - {"7.6875E0"}, {"1.2E1"}, {"7.5E-1"}, {"1.25E0"}, {"1.75E0"}, {"2.25E0"}, {"2.75E0"}, - {"3.25E0"}, {"3.75E0"}, {"4.25E0"}, {"4.75E0"}, {"5.25E0"}, {"5.75E0"}, {"6.25E0"}, - {"6.75E0"}, {"7.25E0"}, {"7.75E0"}, {"1.1E1"}, {"8.125E-1"}, {"1.3125E0"}, {"1.8125E0"}, - {"2.3125E0"}, {"2.8125E0"}, {"3.3125E0"}, {"3.8125E0"}, {"4.3125E0"}, {"4.8125E0"}, {"5.3125E0"}, - {"5.8125E0"}, {"6.3125E0"}, {"6.8125E0"}, {"7.3125E0"}, {"7.8125E0"}, {"1.0E1"}, {"8.75E-1"}, - {"1.375E0"}, {"1.875E0"}, {"2.375E0"}, {"2.875E0"}, {"3.375E0"}, {"3.875E0"}, {"4.375E0"}, - {"4.875E0"}, {"5.375E0"}, {"5.875E0"}, {"6.375E0"}, {"6.875E0"}, {"7.375E0"}, {"7.875E0"}, - {"9.0E0"}, {"9.375E-1"}, {"1.4375E0"}, {"1.9375E0"}, {"2.4375E0"}, {"2.9375E0"}, {"3.4375E0"}, - {"3.9375E0"}, {"4.4375E0"}, {"4.9375E0"}, {"5.4375E0"}, {"5.9375E0"}, {"6.4375E0"}, {"6.9375E0"}, - {"7.4375E0"}, {"7.9375E0"}}; + { "1.6E1" }, { "5.0E-1" }, { "1.0E0" }, { "1.5E0" }, { "2.0E0" }, { "2.5E0" }, { "3.0E0" }, { "3.5E0" }, + { "4.0E0" }, { "4.5E0" }, { "5.0E0" }, { "5.5E0" }, { "6.0E0" }, { "6.5E0" }, { "7.0E0" }, { "7.5E0" }, + { "1.5E1" }, { "5.625E-1" }, { "1.0625E0" }, { "1.5625E0" }, { "2.0625E0" }, { "2.5625E0" }, + { "3.0625E0" }, { "3.5625E0" }, { "4.0625E0" }, { "4.5625E0" }, { "5.0625E0" }, { "5.5625E0" }, + { "6.0625E0" }, { "6.5625E0" }, { "7.0625E0" }, { "7.5625E0" }, { "1.4E1" }, { "6.25E-1" }, + { "1.125E0" }, { "1.625E0" }, { "2.125E0" }, { "2.625E0" }, { "3.125E0" }, { "3.625E0" }, { "4.125E0" }, + { "4.625E0" }, { "5.125E0" }, { "5.625E0" }, { "6.125E0" }, { "6.625E0" }, { "7.125E0" }, { "7.625E0" }, + { "1.3E1" }, { "6.875E-1" }, { "1.1875E0" }, { "1.6875E0" }, { "2.1875E0" }, { "2.6875E0" }, + { "3.1875E0" }, { "3.6875E0" }, { "4.1875E0" }, { "4.6875E0" }, { "5.1875E0" }, { "5.6875E0" }, + { "6.1875E0" }, { "6.6875E0" }, { "7.1875E0" }, { "7.6875E0" }, { "1.2E1" }, { "7.5E-1" }, { "1.25E0" }, + { "1.75E0" }, { "2.25E0" }, { "2.75E0" }, { "3.25E0" }, { "3.75E0" }, { "4.25E0" }, { "4.75E0" }, + { "5.25E0" }, { "5.75E0" }, { "6.25E0" }, { "6.75E0" }, { "7.25E0" }, { "7.75E0" }, { "1.1E1" }, + { "8.125E-1" }, { "1.3125E0" }, { "1.8125E0" }, { "2.3125E0" }, { "2.8125E0" }, { "3.3125E0" }, + { "3.8125E0" }, { "4.3125E0" }, { "4.8125E0" }, { "5.3125E0" }, { "5.8125E0" }, { "6.3125E0" }, + { "6.8125E0" }, { "7.3125E0" }, { "7.8125E0" }, { "1.0E1" }, { "8.75E-1" }, { "1.375E0" }, + { "1.875E0" }, { "2.375E0" }, { "2.875E0" }, { "3.375E0" }, { "3.875E0" }, { "4.375E0" }, { "4.875E0" }, + { "5.375E0" }, { "5.875E0" }, { "6.375E0" }, { "6.875E0" }, { "7.375E0" }, { "7.875E0" }, { "9.0E0" }, + { "9.375E-1" }, { "1.4375E0" }, { "1.9375E0" }, { "2.4375E0" }, { "2.9375E0" }, { "3.4375E0" }, + { "3.9375E0" }, { "4.4375E0" }, { "4.9375E0" }, { "5.4375E0" }, { "5.9375E0" }, { "6.4375E0" }, + { "6.9375E0" }, { "7.4375E0" }, { "7.9375E0" } }; SWTBotShell tableShell = null; String filename = "tfloat16.h5"; String datasetName = "/DS16BITS"; @@ -160,13 +166,13 @@ public void checkHDF5AttrDS16BITS() try { SWTBotTree filetree = bot.tree(); - checkFileTree(filetree, "checkHDF5AttrDS16BITS()", 2, filename); + checkFileTree(filetree, "checkHDF5AttrDS16BITS()", 4, filename); // Open dataset Attribute Table SWTBotTable attrTable = openAttributeTable(filetree, filename, datasetName); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedAttrData); @@ -175,7 +181,7 @@ public void checkHDF5AttrDS16BITS() SWTBotNatTable dataTable = getNatTable(tableShell); retriever = - DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedData); @@ -204,4 +210,147 @@ public void checkHDF5AttrDS16BITS() } } } + + @Test + public void checkHDF5DS16Array() + { + String[][] expectedData = { + { "^\\[16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, .*\\]" } }; + String[][] expectedDataSci = { + { "^\\[1.6E1, 5.0E-1, 1.0E0, 1.5E0, 2.0E0, 2.5E0, 3.0E0, 3.5E0, 4.0E0, 4.5E0, .*\\]" } }; + SWTBotShell tableShell = null; + final String filename = "tfloat16.h5"; + final String datasetName = "/DS16BITS_array"; + File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); + + try { + SWTBotTree filetree = bot.tree(); + + checkFileTree(filetree, "checkHDF5DS16Array()", 4, filename); + + // Open dataset 'DS08BITS' + tableShell = openTreeviewObject(filetree, filename, datasetName); + final SWTBotNatTable dataTable = getNatTable(tableShell); + + TableDataRetriever retriever = DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16Array()", + false); + + retriever.testAllTableLocations(expectedData); + + /* + * TODO: not supported yet + */ + /* + * tableShell.bot().menu().menu("Data Display").menu("Show Scientific Notation").click(); + * retriever.testAllTableLocations(expectedDataSci); + */ + } + catch (Exception ex) { + ex.printStackTrace(); + fail(ex.getMessage()); + } + catch (AssertionError ae) { + ae.printStackTrace(); + fail(ae.getMessage()); + } + finally { + closeShell(tableShell); + + try { + closeFile(hdf_file, false); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + } + + @Test + public void checkHDF5DS16Compound() + { + String[][] expectedData = { + { "16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", + "7.0", "7.5" }, + { "15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", + "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625" }, + { "14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", + "5.625", "6.125", "6.625", "7.125", "7.625" }, + { "13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", + "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875" }, + { "12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", + "6.25", "6.75", "7.25", "7.75" }, + { "11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", + "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125" }, + { "10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", + "5.875", "6.375", "6.875", "7.375", "7.875" }, + { "9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", + "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375" } }; + String[][] expectedDataSci = { + { "1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", "5.0E0", + "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0" }, + { "1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", + "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", + "7.5625E0" }, + { "1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", + "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0" }, + { "1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", + "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", + "7.6875E0" }, + { "1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", "4.75E0", + "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0" }, + { "1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", + "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", + "7.8125E0" }, + { "1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", + "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0" }, + { "9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", + "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", + "7.9375E0" } }; + SWTBotShell tableShell = null; + final String filename = "tfloat16.h5"; + final String datasetName = "/DS16BITS_compound"; + File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); + + try { + SWTBotTree filetree = bot.tree(); + + checkFileTree(filetree, "checkHDF5DS16Compound()", 4, filename); + + // Open dataset 'DS08BITS' + tableShell = openTreeviewObject(filetree, filename, datasetName); + final SWTBotNatTable dataTable = getNatTable(tableShell); + + TableDataRetriever retriever = DataRetrieverFactory.getTableDataRetriever(dataTable, + "checkHDF5DS16Compound()", false); + retriever.setContainerHeaderOffset(2, 0); + + retriever.testAllTableLocations(expectedData); + + /* + * TODO: not supported yet + */ + /* + * tableShell.bot().menu().menu("Data Display").menu("Show Scientific Notation").click(); + * retriever.testAllTableLocations(expectedDataSci); + */ + } + catch (Exception ex) { + ex.printStackTrace(); + fail(ex.getMessage()); + } + catch (AssertionError ae) { + ae.printStackTrace(); + fail(ae.getMessage()); + } + finally { + closeShell(tableShell); + + try { + closeFile(hdf_file, false); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + } } diff --git a/test/org.hdfgroup.hdfview.test/uitest/tfloat16.h5 b/test/org.hdfgroup.hdfview.test/uitest/tfloat16.h5 index a0cccc57edc64d34601b9e6c4482ef7d9b68aa90..a414806ca9280afb1d2ff017b9d205a5f0f1a6d8 100644 GIT binary patch delta 355 zcmZn=nxHg6gGoSeqE;KD#Kw*6OpFebcQUCPx&#}VIeCTz$0z6K7UY-ar7%DMTs*O; zD6x`(fe|V$FX31G6+E=j1ue3hW@m85k@kZcJNz zl9h2XBgg+m9E_V!uvs#0Jn#aD?=#i|&4aiI>MTYE4X~w*Ob`K>YjM%c3jw4+J26f(ra#agZn%D+3olP>dC*3Me Date: Wed, 1 May 2024 19:56:42 +0000 Subject: [PATCH 16/16] Committing clang-format changes --- .../uitest/TestHDFViewFloat16.java | 258 +++++++++--------- 1 file changed, 124 insertions(+), 134 deletions(-) diff --git a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java index 16db7b10..10ad8a63 100644 --- a/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java +++ b/test/org.hdfgroup.hdfview.test/uitest/TestHDFViewFloat16.java @@ -33,43 +33,39 @@ public class TestHDFViewFloat16 extends AbstractWindowTest { public void checkHDF5DS16BITS() { String[][] expectedData = { - { "16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", - "7.0", "7.5" }, - { "15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", - "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625" }, - { "14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", - "5.625", "6.125", "6.625", "7.125", "7.625" }, - { "13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", - "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875" }, - { "12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", - "6.25", "6.75", "7.25", "7.75" }, - { "11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", - "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125" }, - { "10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", - "5.875", "6.375", "6.875", "7.375", "7.875" }, - { "9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", - "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375" } }; + {"16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", + "6.5", "7.0", "7.5"}, + {"15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", + "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625"}, + {"14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", + "5.625", "6.125", "6.625", "7.125", "7.625"}, + {"13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", + "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875"}, + {"12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", + "6.25", "6.75", "7.25", "7.75"}, + {"11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", + "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125"}, + {"10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", + "5.875", "6.375", "6.875", "7.375", "7.875"}, + {"9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", + "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375"}}; String[][] expectedDataSci = { - { "1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", "5.0E0", - "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0" }, - { "1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", - "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", - "7.5625E0" }, - { "1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", - "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0" }, - { "1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", - "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", - "7.6875E0" }, - { "1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", "4.75E0", - "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0" }, - { "1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", - "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", - "7.8125E0" }, - { "1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", - "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0" }, - { "9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", - "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", - "7.9375E0" } }; + {"1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", + "5.0E0", "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0"}, + {"1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", + "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", "7.5625E0"}, + {"1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", + "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0"}, + {"1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", + "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", "7.6875E0"}, + {"1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", + "4.75E0", "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0"}, + {"1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", + "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", "7.8125E0"}, + {"1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", + "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0"}, + {"9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", + "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", "7.9375E0"}}; SWTBotShell tableShell = null; final String filename = "tfloat16.h5"; final String datasetName = "/DS16BITS"; @@ -85,7 +81,7 @@ public void checkHDF5DS16BITS() final SWTBotNatTable dataTable = getNatTable(tableShell); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16BITS()", false); retriever.testAllTableLocations(expectedData); @@ -116,47 +112,45 @@ public void checkHDF5DS16BITS() public void checkHDF5AttrDS16BITS() { String[][] expectedAttrData = { - { "DS16BITS", "16-bit floating-point", "128", - "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875" } }; + {"DS16BITS", "16-bit floating-point", "128", + "16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 15.0, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625, 14.0, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625, 13.0, 0.6875"}}; String[][] expectedData = { - { "16.0" }, { "0.5" }, { "1.0" }, { "1.5" }, { "2.0" }, { "2.5" }, { "3.0" }, { "3.5" }, { "4.0" }, - { "4.5" }, { "5.0" }, { "5.5" }, { "6.0" }, { "6.5" }, { "7.0" }, { "7.5" }, { "15.0" }, { "0.5625" }, - { "1.0625" }, { "1.5625" }, { "2.0625" }, { "2.5625" }, { "3.0625" }, { "3.5625" }, { "4.0625" }, - { "4.5625" }, { "5.0625" }, { "5.5625" }, { "6.0625" }, { "6.5625" }, { "7.0625" }, { "7.5625" }, - { "14.0" }, { "0.625" }, { "1.125" }, { "1.625" }, { "2.125" }, { "2.625" }, { "3.125" }, { "3.625" }, - { "4.125" }, { "4.625" }, { "5.125" }, { "5.625" }, { "6.125" }, { "6.625" }, { "7.125" }, { "7.625" }, - { "13.0" }, { "0.6875" }, { "1.1875" }, { "1.6875" }, { "2.1875" }, { "2.6875" }, { "3.1875" }, - { "3.6875" }, { "4.1875" }, { "4.6875" }, { "5.1875" }, { "5.6875" }, { "6.1875" }, { "6.6875" }, - { "7.1875" }, { "7.6875" }, { "12.0" }, { "0.75" }, { "1.25" }, { "1.75" }, { "2.25" }, { "2.75" }, - { "3.25" }, { "3.75" }, { "4.25" }, { "4.75" }, { "5.25" }, { "5.75" }, { "6.25" }, { "6.75" }, - { "7.25" }, { "7.75" }, { "11.0" }, { "0.8125" }, { "1.3125" }, { "1.8125" }, { "2.3125" }, - { "2.8125" }, { "3.3125" }, { "3.8125" }, { "4.3125" }, { "4.8125" }, { "5.3125" }, { "5.8125" }, - { "6.3125" }, { "6.8125" }, { "7.3125" }, { "7.8125" }, { "10.0" }, { "0.875" }, { "1.375" }, - { "1.875" }, { "2.375" }, { "2.875" }, { "3.375" }, { "3.875" }, { "4.375" }, { "4.875" }, { "5.375" }, - { "5.875" }, { "6.375" }, { "6.875" }, { "7.375" }, { "7.875" }, { "9.0" }, { "0.9375" }, { "1.4375" }, - { "1.9375" }, { "2.4375" }, { "2.9375" }, { "3.4375" }, { "3.9375" }, { "4.4375" }, { "4.9375" }, - { "5.4375" }, { "5.9375" }, { "6.4375" }, { "6.9375" }, { "7.4375" }, { "7.9375" } }; + {"16.0"}, {"0.5"}, {"1.0"}, {"1.5"}, {"2.0"}, {"2.5"}, {"3.0"}, {"3.5"}, + {"4.0"}, {"4.5"}, {"5.0"}, {"5.5"}, {"6.0"}, {"6.5"}, {"7.0"}, {"7.5"}, + {"15.0"}, {"0.5625"}, {"1.0625"}, {"1.5625"}, {"2.0625"}, {"2.5625"}, {"3.0625"}, {"3.5625"}, + {"4.0625"}, {"4.5625"}, {"5.0625"}, {"5.5625"}, {"6.0625"}, {"6.5625"}, {"7.0625"}, {"7.5625"}, + {"14.0"}, {"0.625"}, {"1.125"}, {"1.625"}, {"2.125"}, {"2.625"}, {"3.125"}, {"3.625"}, + {"4.125"}, {"4.625"}, {"5.125"}, {"5.625"}, {"6.125"}, {"6.625"}, {"7.125"}, {"7.625"}, + {"13.0"}, {"0.6875"}, {"1.1875"}, {"1.6875"}, {"2.1875"}, {"2.6875"}, {"3.1875"}, {"3.6875"}, + {"4.1875"}, {"4.6875"}, {"5.1875"}, {"5.6875"}, {"6.1875"}, {"6.6875"}, {"7.1875"}, {"7.6875"}, + {"12.0"}, {"0.75"}, {"1.25"}, {"1.75"}, {"2.25"}, {"2.75"}, {"3.25"}, {"3.75"}, + {"4.25"}, {"4.75"}, {"5.25"}, {"5.75"}, {"6.25"}, {"6.75"}, {"7.25"}, {"7.75"}, + {"11.0"}, {"0.8125"}, {"1.3125"}, {"1.8125"}, {"2.3125"}, {"2.8125"}, {"3.3125"}, {"3.8125"}, + {"4.3125"}, {"4.8125"}, {"5.3125"}, {"5.8125"}, {"6.3125"}, {"6.8125"}, {"7.3125"}, {"7.8125"}, + {"10.0"}, {"0.875"}, {"1.375"}, {"1.875"}, {"2.375"}, {"2.875"}, {"3.375"}, {"3.875"}, + {"4.375"}, {"4.875"}, {"5.375"}, {"5.875"}, {"6.375"}, {"6.875"}, {"7.375"}, {"7.875"}, + {"9.0"}, {"0.9375"}, {"1.4375"}, {"1.9375"}, {"2.4375"}, {"2.9375"}, {"3.4375"}, {"3.9375"}, + {"4.4375"}, {"4.9375"}, {"5.4375"}, {"5.9375"}, {"6.4375"}, {"6.9375"}, {"7.4375"}, {"7.9375"}}; String[][] expectedDataSci = { - { "1.6E1" }, { "5.0E-1" }, { "1.0E0" }, { "1.5E0" }, { "2.0E0" }, { "2.5E0" }, { "3.0E0" }, { "3.5E0" }, - { "4.0E0" }, { "4.5E0" }, { "5.0E0" }, { "5.5E0" }, { "6.0E0" }, { "6.5E0" }, { "7.0E0" }, { "7.5E0" }, - { "1.5E1" }, { "5.625E-1" }, { "1.0625E0" }, { "1.5625E0" }, { "2.0625E0" }, { "2.5625E0" }, - { "3.0625E0" }, { "3.5625E0" }, { "4.0625E0" }, { "4.5625E0" }, { "5.0625E0" }, { "5.5625E0" }, - { "6.0625E0" }, { "6.5625E0" }, { "7.0625E0" }, { "7.5625E0" }, { "1.4E1" }, { "6.25E-1" }, - { "1.125E0" }, { "1.625E0" }, { "2.125E0" }, { "2.625E0" }, { "3.125E0" }, { "3.625E0" }, { "4.125E0" }, - { "4.625E0" }, { "5.125E0" }, { "5.625E0" }, { "6.125E0" }, { "6.625E0" }, { "7.125E0" }, { "7.625E0" }, - { "1.3E1" }, { "6.875E-1" }, { "1.1875E0" }, { "1.6875E0" }, { "2.1875E0" }, { "2.6875E0" }, - { "3.1875E0" }, { "3.6875E0" }, { "4.1875E0" }, { "4.6875E0" }, { "5.1875E0" }, { "5.6875E0" }, - { "6.1875E0" }, { "6.6875E0" }, { "7.1875E0" }, { "7.6875E0" }, { "1.2E1" }, { "7.5E-1" }, { "1.25E0" }, - { "1.75E0" }, { "2.25E0" }, { "2.75E0" }, { "3.25E0" }, { "3.75E0" }, { "4.25E0" }, { "4.75E0" }, - { "5.25E0" }, { "5.75E0" }, { "6.25E0" }, { "6.75E0" }, { "7.25E0" }, { "7.75E0" }, { "1.1E1" }, - { "8.125E-1" }, { "1.3125E0" }, { "1.8125E0" }, { "2.3125E0" }, { "2.8125E0" }, { "3.3125E0" }, - { "3.8125E0" }, { "4.3125E0" }, { "4.8125E0" }, { "5.3125E0" }, { "5.8125E0" }, { "6.3125E0" }, - { "6.8125E0" }, { "7.3125E0" }, { "7.8125E0" }, { "1.0E1" }, { "8.75E-1" }, { "1.375E0" }, - { "1.875E0" }, { "2.375E0" }, { "2.875E0" }, { "3.375E0" }, { "3.875E0" }, { "4.375E0" }, { "4.875E0" }, - { "5.375E0" }, { "5.875E0" }, { "6.375E0" }, { "6.875E0" }, { "7.375E0" }, { "7.875E0" }, { "9.0E0" }, - { "9.375E-1" }, { "1.4375E0" }, { "1.9375E0" }, { "2.4375E0" }, { "2.9375E0" }, { "3.4375E0" }, - { "3.9375E0" }, { "4.4375E0" }, { "4.9375E0" }, { "5.4375E0" }, { "5.9375E0" }, { "6.4375E0" }, - { "6.9375E0" }, { "7.4375E0" }, { "7.9375E0" } }; + {"1.6E1"}, {"5.0E-1"}, {"1.0E0"}, {"1.5E0"}, {"2.0E0"}, {"2.5E0"}, {"3.0E0"}, + {"3.5E0"}, {"4.0E0"}, {"4.5E0"}, {"5.0E0"}, {"5.5E0"}, {"6.0E0"}, {"6.5E0"}, + {"7.0E0"}, {"7.5E0"}, {"1.5E1"}, {"5.625E-1"}, {"1.0625E0"}, {"1.5625E0"}, {"2.0625E0"}, + {"2.5625E0"}, {"3.0625E0"}, {"3.5625E0"}, {"4.0625E0"}, {"4.5625E0"}, {"5.0625E0"}, {"5.5625E0"}, + {"6.0625E0"}, {"6.5625E0"}, {"7.0625E0"}, {"7.5625E0"}, {"1.4E1"}, {"6.25E-1"}, {"1.125E0"}, + {"1.625E0"}, {"2.125E0"}, {"2.625E0"}, {"3.125E0"}, {"3.625E0"}, {"4.125E0"}, {"4.625E0"}, + {"5.125E0"}, {"5.625E0"}, {"6.125E0"}, {"6.625E0"}, {"7.125E0"}, {"7.625E0"}, {"1.3E1"}, + {"6.875E-1"}, {"1.1875E0"}, {"1.6875E0"}, {"2.1875E0"}, {"2.6875E0"}, {"3.1875E0"}, {"3.6875E0"}, + {"4.1875E0"}, {"4.6875E0"}, {"5.1875E0"}, {"5.6875E0"}, {"6.1875E0"}, {"6.6875E0"}, {"7.1875E0"}, + {"7.6875E0"}, {"1.2E1"}, {"7.5E-1"}, {"1.25E0"}, {"1.75E0"}, {"2.25E0"}, {"2.75E0"}, + {"3.25E0"}, {"3.75E0"}, {"4.25E0"}, {"4.75E0"}, {"5.25E0"}, {"5.75E0"}, {"6.25E0"}, + {"6.75E0"}, {"7.25E0"}, {"7.75E0"}, {"1.1E1"}, {"8.125E-1"}, {"1.3125E0"}, {"1.8125E0"}, + {"2.3125E0"}, {"2.8125E0"}, {"3.3125E0"}, {"3.8125E0"}, {"4.3125E0"}, {"4.8125E0"}, {"5.3125E0"}, + {"5.8125E0"}, {"6.3125E0"}, {"6.8125E0"}, {"7.3125E0"}, {"7.8125E0"}, {"1.0E1"}, {"8.75E-1"}, + {"1.375E0"}, {"1.875E0"}, {"2.375E0"}, {"2.875E0"}, {"3.375E0"}, {"3.875E0"}, {"4.375E0"}, + {"4.875E0"}, {"5.375E0"}, {"5.875E0"}, {"6.375E0"}, {"6.875E0"}, {"7.375E0"}, {"7.875E0"}, + {"9.0E0"}, {"9.375E-1"}, {"1.4375E0"}, {"1.9375E0"}, {"2.4375E0"}, {"2.9375E0"}, {"3.4375E0"}, + {"3.9375E0"}, {"4.4375E0"}, {"4.9375E0"}, {"5.4375E0"}, {"5.9375E0"}, {"6.4375E0"}, {"6.9375E0"}, + {"7.4375E0"}, {"7.9375E0"}}; SWTBotShell tableShell = null; String filename = "tfloat16.h5"; String datasetName = "/DS16BITS"; @@ -172,7 +166,7 @@ public void checkHDF5AttrDS16BITS() SWTBotTable attrTable = openAttributeTable(filetree, filename, datasetName); TableDataRetriever retriever = - DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(attrTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedAttrData); @@ -181,7 +175,7 @@ public void checkHDF5AttrDS16BITS() SWTBotNatTable dataTable = getNatTable(tableShell); retriever = - DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5AttrDS16BITS()", false); retriever.testAllTableLocations(expectedData); @@ -214,14 +208,14 @@ public void checkHDF5AttrDS16BITS() @Test public void checkHDF5DS16Array() { - String[][] expectedData = { - { "^\\[16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, .*\\]" } }; - String[][] expectedDataSci = { - { "^\\[1.6E1, 5.0E-1, 1.0E0, 1.5E0, 2.0E0, 2.5E0, 3.0E0, 3.5E0, 4.0E0, 4.5E0, .*\\]" } }; - SWTBotShell tableShell = null; - final String filename = "tfloat16.h5"; - final String datasetName = "/DS16BITS_array"; - File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); + String[][] expectedData = { + {"^\\[16.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, .*\\]"}}; + String[][] expectedDataSci = { + {"^\\[1.6E1, 5.0E-1, 1.0E0, 1.5E0, 2.0E0, 2.5E0, 3.0E0, 3.5E0, 4.0E0, 4.5E0, .*\\]"}}; + SWTBotShell tableShell = null; + final String filename = "tfloat16.h5"; + final String datasetName = "/DS16BITS_array"; + File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); try { SWTBotTree filetree = bot.tree(); @@ -229,11 +223,11 @@ public void checkHDF5DS16Array() checkFileTree(filetree, "checkHDF5DS16Array()", 4, filename); // Open dataset 'DS08BITS' - tableShell = openTreeviewObject(filetree, filename, datasetName); + tableShell = openTreeviewObject(filetree, filename, datasetName); final SWTBotNatTable dataTable = getNatTable(tableShell); - TableDataRetriever retriever = DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16Array()", - false); + TableDataRetriever retriever = + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16Array()", false); retriever.testAllTableLocations(expectedData); @@ -268,48 +262,44 @@ public void checkHDF5DS16Array() @Test public void checkHDF5DS16Compound() { - String[][] expectedData = { - { "16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", - "7.0", "7.5" }, - { "15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", - "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625" }, - { "14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", - "5.625", "6.125", "6.625", "7.125", "7.625" }, - { "13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", - "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875" }, - { "12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", - "6.25", "6.75", "7.25", "7.75" }, - { "11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", - "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125" }, - { "10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", - "5.875", "6.375", "6.875", "7.375", "7.875" }, - { "9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", - "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375" } }; - String[][] expectedDataSci = { - { "1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", "5.0E0", - "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0" }, - { "1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", - "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", - "7.5625E0" }, - { "1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", - "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0" }, - { "1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", - "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", - "7.6875E0" }, - { "1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", "4.75E0", - "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0" }, - { "1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", - "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", - "7.8125E0" }, - { "1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", - "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0" }, - { "9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", - "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", - "7.9375E0" } }; - SWTBotShell tableShell = null; - final String filename = "tfloat16.h5"; - final String datasetName = "/DS16BITS_compound"; - File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); + String[][] expectedData = { + {"16.0", "0.5", "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", + "6.5", "7.0", "7.5"}, + {"15.0", "0.5625", "1.0625", "1.5625", "2.0625", "2.5625", "3.0625", "3.5625", "4.0625", "4.5625", + "5.0625", "5.5625", "6.0625", "6.5625", "7.0625", "7.5625"}, + {"14.0", "0.625", "1.125", "1.625", "2.125", "2.625", "3.125", "3.625", "4.125", "4.625", "5.125", + "5.625", "6.125", "6.625", "7.125", "7.625"}, + {"13.0", "0.6875", "1.1875", "1.6875", "2.1875", "2.6875", "3.1875", "3.6875", "4.1875", "4.6875", + "5.1875", "5.6875", "6.1875", "6.6875", "7.1875", "7.6875"}, + {"12.0", "0.75", "1.25", "1.75", "2.25", "2.75", "3.25", "3.75", "4.25", "4.75", "5.25", "5.75", + "6.25", "6.75", "7.25", "7.75"}, + {"11.0", "0.8125", "1.3125", "1.8125", "2.3125", "2.8125", "3.3125", "3.8125", "4.3125", "4.8125", + "5.3125", "5.8125", "6.3125", "6.8125", "7.3125", "7.8125"}, + {"10.0", "0.875", "1.375", "1.875", "2.375", "2.875", "3.375", "3.875", "4.375", "4.875", "5.375", + "5.875", "6.375", "6.875", "7.375", "7.875"}, + {"9.0", "0.9375", "1.4375", "1.9375", "2.4375", "2.9375", "3.4375", "3.9375", "4.4375", "4.9375", + "5.4375", "5.9375", "6.4375", "6.9375", "7.4375", "7.9375"}}; + String[][] expectedDataSci = { + {"1.6E1", "5.0E-1", "1.0E0", "1.5E0", "2.0E0", "2.5E0", "3.0E0", "3.5E0", "4.0E0", "4.5E0", + "5.0E0", "5.5E0", "6.0E0", "6.5E0", "7.0E0", "7.5E0"}, + {"1.5E1", "5.625E-1", "1.0625E0", "1.5625E0", "2.0625E0", "2.5625E0", "3.0625E0", "3.5625E0", + "4.0625E0", "4.5625E0", "5.0625E0", "5.5625E0", "6.0625E0", "6.5625E0", "7.0625E0", "7.5625E0"}, + {"1.4E1", "6.25E-1", "1.125E0", "1.625E0", "2.125E0", "2.625E0", "3.125E0", "3.625E0", "4.125E0", + "4.625E0", "5.125E0", "5.625E0", "6.125E0", "6.625E0", "7.125E0", "7.625E0"}, + {"1.3E1", "6.875E-1", "1.1875E0", "1.6875E0", "2.1875E0", "2.6875E0", "3.1875E0", "3.6875E0", + "4.1875E0", "4.6875E0", "5.1875E0", "5.6875E0", "6.1875E0", "6.6875E0", "7.1875E0", "7.6875E0"}, + {"1.2E1", "7.5E-1", "1.25E0", "1.75E0", "2.25E0", "2.75E0", "3.25E0", "3.75E0", "4.25E0", + "4.75E0", "5.25E0", "5.75E0", "6.25E0", "6.75E0", "7.25E0", "7.75E0"}, + {"1.1E1", "8.125E-1", "1.3125E0", "1.8125E0", "2.3125E0", "2.8125E0", "3.3125E0", "3.8125E0", + "4.3125E0", "4.8125E0", "5.3125E0", "5.8125E0", "6.3125E0", "6.8125E0", "7.3125E0", "7.8125E0"}, + {"1.0E1", "8.75E-1", "1.375E0", "1.875E0", "2.375E0", "2.875E0", "3.375E0", "3.875E0", "4.375E0", + "4.875E0", "5.375E0", "5.875E0", "6.375E0", "6.875E0", "7.375E0", "7.875E0"}, + {"9.0E0", "9.375E-1", "1.4375E0", "1.9375E0", "2.4375E0", "2.9375E0", "3.4375E0", "3.9375E0", + "4.4375E0", "4.9375E0", "5.4375E0", "5.9375E0", "6.4375E0", "6.9375E0", "7.4375E0", "7.9375E0"}}; + SWTBotShell tableShell = null; + final String filename = "tfloat16.h5"; + final String datasetName = "/DS16BITS_compound"; + File hdf_file = openFile(filename, FILE_MODE.READ_ONLY); try { SWTBotTree filetree = bot.tree(); @@ -317,11 +307,11 @@ public void checkHDF5DS16Compound() checkFileTree(filetree, "checkHDF5DS16Compound()", 4, filename); // Open dataset 'DS08BITS' - tableShell = openTreeviewObject(filetree, filename, datasetName); + tableShell = openTreeviewObject(filetree, filename, datasetName); final SWTBotNatTable dataTable = getNatTable(tableShell); - TableDataRetriever retriever = DataRetrieverFactory.getTableDataRetriever(dataTable, - "checkHDF5DS16Compound()", false); + TableDataRetriever retriever = + DataRetrieverFactory.getTableDataRetriever(dataTable, "checkHDF5DS16Compound()", false); retriever.setContainerHeaderOffset(2, 0); retriever.testAllTableLocations(expectedData);