diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 0b06395d..b9ceb327 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -1290,6 +1290,12 @@ else if (baseTypeDataProvider instanceof RefDataProvider) { */ theValue = retrieveArrayOfArrayElements(dataBuf, columnIndex, bufIndex); } + else if (baseTypeDataProvider instanceof ComplexDataProvider) { + /* + * TODO: assign to global arrayElements. + */ + theValue = retrieveArrayOfComplexElements(dataBuf, columnIndex, bufIndex); + } else { /* * TODO: assign to global arrayElements. @@ -1329,6 +1335,9 @@ else if (baseTypeDataProvider instanceof ArrayDataProvider) { else if (baseTypeDataProvider instanceof RefDataProvider) { theValue = retrieveArrayOfArrayElements(obj, columnIndex, rowIndex); } + else if (baseTypeDataProvider instanceof ComplexDataProvider) { + theValue = retrieveArrayOfComplexElements(obj, columnIndex, rowIndex); + } else { theValue = retrieveArrayOfAtomicElements(obj, rowIndex); } @@ -1389,6 +1398,34 @@ private Object[] retrieveArrayOfArrayElements(Object objBuf, int columnIndex, in return tempArray; } + private Object[] retrieveArrayOfComplexElements(Object objBuf, int columnIndex, int startRowIndex) + { + log.debug("retrieveArrayOfComplexElements(): objBuf={}", objBuf); + ArrayList vlElements = ((ArrayList[]) objBuf)[startRowIndex]; + log.debug("retrieveArrayOfComplexElements(): vlElements={}", vlElements); + long vlSize = vlElements.size(); + log.debug("retrieveArrayOfComplexElements(): vlSize={} length={}", vlSize, vlElements.size()); + Object[] tempArray = new Object[(int) vlSize]; + + for (int i = 0; i < vlSize; i++) { + ArrayList ref_value = vlElements; + StringBuilder sb = new StringBuilder(); + sb.append("{"); + for (int m = 0; m < ref_value.size(); m++) { + if (m > 0) + sb.append(", "); + byte[] byteElements = ref_value.get(m); + log.trace("retrieveArrayOfComplexElements byteElements={}", byteElements); + sb.append(baseTypeDataProvider.getDataValue(byteElements, columnIndex, i * 2)); + } + sb.append("}"); + tempArray[i] = sb.toString(); + log.trace("retrieveArrayOfComplexElements(tempArray[{}]={}): start", i, tempArray); + } + + return tempArray; + } + private Object[] retrieveArrayOfAtomicElements(Object objBuf, int rowStartIdx) { ArrayList vlElements = ((ArrayList[])objBuf)[rowStartIdx]; diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java index 279287c3..c3819dfd 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java @@ -2818,16 +2818,16 @@ else if (this.isCompound()) { return topTID; } - private boolean datatypeIsComplicated(long tid) + private boolean datatypeIsComposite(long tid) { long tclass = HDF5Constants.H5T_NO_CLASS; try { tclass = H5.H5Tget_class(tid); - log.trace("datatypeIsComplicated():{}", tclass); + log.trace("datatypeIsComposite():{}", tclass); } catch (Exception ex) { - log.debug("datatypeIsComplicated():", ex); + log.debug("datatypeIsComposite():", ex); } boolean retVal = (tclass == HDF5Constants.H5T_COMPOUND); @@ -2855,14 +2855,14 @@ private boolean datatypeIsReference(long tid) private boolean datatypeIsAtomic(long tid) { - boolean retVal = !(datatypeIsComplicated(tid) | datatypeIsReference(tid) | isRef()); + boolean retVal = !(datatypeIsComposite(tid) | datatypeIsReference(tid) | isRef()); retVal |= isOpaque(); retVal |= isBitField(); return retVal; } - private boolean datatypeClassIsComplicated(long tclass) + private boolean datatypeClassIsComposite(long tclass) { boolean retVal = (tclass == HDF5Constants.H5T_COMPOUND); retVal |= (tclass == HDF5Constants.H5T_ENUM); @@ -2879,7 +2879,7 @@ private boolean datatypeClassIsComplicated(long tclass) private boolean datatypeClassIsAtomic(long tclass) { - boolean retVal = !(datatypeClassIsComplicated(tclass) | datatypeClassIsReference(tclass)); + boolean retVal = !(datatypeClassIsComposite(tclass) | datatypeClassIsReference(tclass)); retVal |= (tclass == Datatype.CLASS_OPAQUE); retVal |= (tclass == Datatype.CLASS_BITFIELD); diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarAttr.java b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarAttr.java index f467ffe7..2bb34798 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5ScalarAttr.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5ScalarAttr.java @@ -1225,7 +1225,7 @@ else if (dsDatatype.isCompound()) { for (int j = 0; j < lsize; j++) strs[j] = ""; try { - log.trace("AttributeCommonIO():read ioType H5AreadComplicated"); + log.trace("AttributeCommonIO():read ioType H5AreadComposite"); H5.H5AreadComplex(attr_id, tid, strs); } catch (Exception ex) {