Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 18, 2024
1 parent d515ab4 commit 22831e3
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,10 @@ private static class ComplexDataDisplayConverter extends HDFDisplayConverter {
private static final Logger log = LoggerFactory.getLogger(ComplexDataDisplayConverter.class);

private final HDFDisplayConverter baseTypeConverter;
private final StringBuilder buffer;
private final StringBuilder buffer;

ComplexDataDisplayConverter(final Datatype dtype) throws Exception {
ComplexDataDisplayConverter(final Datatype dtype) throws Exception
{
super(dtype);

if (!dtype.isComplex()) {
Expand Down Expand Up @@ -1000,8 +1001,9 @@ private static class ComplexDataDisplayConverter extends HDFDisplayConverter {
}
catch (Exception ex) {
log.debug("exit: couldn't get DataDisplayConverter for base datatype: ", ex);
throw new Exception("ComplexDataDisplayConverter: couldn't get DataDisplayConverter for base datatype: "
+ ex.getMessage());
throw new Exception(
"ComplexDataDisplayConverter: couldn't get DataDisplayConverter for base datatype: " +
ex.getMessage());
}

buffer = new StringBuilder();
Expand Down Expand Up @@ -1031,16 +1033,16 @@ public Object canonicalToDisplayValue(Object value)
buffer.setLength(0); // clear the old string

/*
* Pass the cell's row and column index down in case there is a CompoundDataDisplayConverter at the bottom
* of the chain.
* Pass the cell's row and column index down in case there is a CompoundDataDisplayConverter at
* the bottom of the chain.
*/
baseTypeConverter.cellRowIdx = cellRowIdx;
baseTypeConverter.cellColIdx = cellColIdx;

try {
Object obj;
Object convertedValue;
int arrLen = Array.getLength(value);
int arrLen = Array.getLength(value);

log.trace("canonicalToDisplayValue({}): array length={}", value, arrLen);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,9 @@ private static class ComplexDataProvider extends HDFDataProvider {

private final long typeSize;

ComplexDataProvider(final Datatype dtype, final Object dataBuf, final boolean dataTransposed) throws Exception {
ComplexDataProvider(final Datatype dtype, final Object dataBuf, final boolean dataTransposed)
throws Exception
{
super(dtype, dataBuf, dataTransposed);

Datatype baseType = dtype.getDatatypeBase();
Expand All @@ -1984,26 +1986,28 @@ public Object getDataValue(int columnIndex, int rowIndex)

try {
int bufIndex = physicalLocationToBufIndex(rowIndex, columnIndex);
theValue = retrieveArrayOfAtomicElements(dataBuf, bufIndex * 2);
theValue = retrieveArrayOfAtomicElements(dataBuf, bufIndex * 2);
log.trace("getDataValue(bufIndex={}, dataBuf={})=({})", bufIndex, dataBuf, theValue);
}
catch (Exception ex) {
log.debug("getDataValue(rowIndex={}, columnIndex={}): failure: ", rowIndex, columnIndex, ex);
theValue = DataFactoryUtils.errStr;
}

log.trace("getDataValue(rowIndex={}, columnIndex={})=({}): finish", rowIndex, columnIndex, theValue);
log.trace("getDataValue(rowIndex={}, columnIndex={})=({}): finish", rowIndex, columnIndex,
theValue);

return theValue;
}

private Object[] retrieveArrayOfAtomicElements(Object objBuf, int rowStartIdx)
{
log.debug("retrieveArrayOfAtomicElements(): objBuf={}", objBuf);
Object[] tempArray = new Object[(int) 2];
Object realElement = Array.get(objBuf, rowStartIdx);
Object imgElement = Array.get(objBuf, rowStartIdx + 1);
log.debug("retrieveArrayOfAtomicElements(): realElement={} imgElement={}", realElement, imgElement);
Object[] tempArray = new Object[(int)2];
Object realElement = Array.get(objBuf, rowStartIdx);
Object imgElement = Array.get(objBuf, rowStartIdx + 1);
log.debug("retrieveArrayOfAtomicElements(): realElement={} imgElement={}", realElement,
imgElement);

tempArray[0] = baseTypeDataProvider.getDataValue(objBuf, rowStartIdx);
tempArray[1] = baseTypeDataProvider.getDataValue(objBuf, rowStartIdx + 1);
Expand All @@ -2021,10 +2025,11 @@ public void setDataValue(int columnIndex, int rowIndex, Object newValue)
updateArrayElements(dataBuf, newValue, columnIndex, rowIndex);
}
catch (Exception ex) {
log.debug("setDataValue(rowIndex={}, columnIndex={}, {}): cell value update failure: ", rowIndex,
columnIndex, newValue, ex);
log.debug("setDataValue(rowIndex={}, columnIndex={}, {}): cell value update failure: ",
rowIndex, columnIndex, newValue, ex);
}
log.trace("setDataValue(rowIndex={}, columnIndex={})=({}): finish", rowIndex, columnIndex, newValue);
log.trace("setDataValue(rowIndex={}, columnIndex={})=({}): finish", rowIndex, columnIndex,
newValue);
}

@Override
Expand All @@ -2034,11 +2039,12 @@ public void setDataValue(int columnIndex, int rowIndex, Object bufObject, Object
updateArrayElements(bufObject, newValue, columnIndex, rowIndex);
}
catch (Exception ex) {
log.debug("setDataValue(rowIndex={}, columnIndex={}, bufObject={}, {}): cell value update failure: ",
rowIndex, columnIndex, bufObject, newValue, ex);
log.debug(
"setDataValue(rowIndex={}, columnIndex={}, bufObject={}, {}): cell value update failure: ",
rowIndex, columnIndex, bufObject, newValue, ex);
}
log.trace("setDataValue(rowIndex={}, columnIndex={}, bufObject={})=({}): finish", rowIndex, columnIndex,
bufObject, newValue);
log.trace("setDataValue(rowIndex={}, columnIndex={}, bufObject={})=({}): finish", rowIndex,
columnIndex, bufObject, newValue);
}

private void updateArrayElements(Object curBuf, Object newValue, int columnIndex, int rowStartIndex)
Expand All @@ -2048,11 +2054,11 @@ private void updateArrayElements(Object curBuf, Object newValue, int columnIndex

private void updateArrayOfAtomicElements(Object newValue, Object curBuf, int rowStartIdx)
{
ArrayList vlElements = ((ArrayList[]) curBuf)[rowStartIdx];
ArrayList vlElements = ((ArrayList[])curBuf)[rowStartIdx];

StringTokenizer st = new StringTokenizer((String) newValue, "+i");
int newcnt = st.countTokens();
Object[] buffer = new Double[newcnt];
StringTokenizer st = new StringTokenizer((String)newValue, "+i");
int newcnt = st.countTokens();
Object[] buffer = new Double[newcnt];
for (int i = 0; i < newcnt; i++) {
baseTypeDataProvider.setDataValue(i, buffer, st.nextToken().trim());
isValueChanged = isValueChanged || baseTypeDataProvider.getIsValueChanged();
Expand All @@ -2062,7 +2068,7 @@ private void updateArrayOfAtomicElements(Object newValue, Object curBuf, int row
log.trace("updateArrayOfAtomicElements(): buffer cname={} of data cname={}", bname, cname);
vlElements = new ArrayList<>(Arrays.asList(buffer));
log.debug("updateArrayOfAtomicElements(): new vlSize={}", vlElements.size());
((ArrayList[]) curBuf)[rowStartIdx] = vlElements;
((ArrayList[])curBuf)[rowStartIdx] = vlElements;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public class UserOptionsHDFPage extends UserOptionsDefaultPage {
private Button checkNativeOrder, checkDecOrder, checkIncOrder;
private Button checkIndexName, checkIndexCreateOrder;
private Button earlyLibVersion, early18LibVersion, early110LibVersion, early112LibVersion,
early114LibVersion, early200LibVersion, earlyLateLibVersion;
early114LibVersion, early200LibVersion, earlyLateLibVersion;
private Button lateLibVersion, late18LibVersion, late110LibVersion, late112LibVersion, late114LibVersion,
late200LibVersion, lateLateLibVersion;
late200LibVersion, lateLateLibVersion;
private Button pluginDirButton;

/** Default early libversion for files */
Expand Down
5 changes: 1 addition & 4 deletions src/org.hdfgroup.object/hdf/object/Datatype.java
Original file line number Diff line number Diff line change
Expand Up @@ -1017,10 +1017,7 @@ public boolean isUnsigned()
*
* @return true if the datatype is complex; false otherwise
*/
public boolean isComplex()
{
return (datatypeClass == Datatype.CLASS_COMPLEX);
}
public boolean isComplex() { return (datatypeClass == Datatype.CLASS_COMPLEX); }

/* Implement interface MetaDataContainer */

Expand Down
12 changes: 6 additions & 6 deletions src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public void fromNative(long tid)
tsize = H5.H5Tget_size(tid);
isVariableStr = H5.H5Tis_variable_str(tid);
isVLEN = false;
isComplex = false;
isComplex = false;
log.trace("fromNative(): tclass={}, tsize={}, torder={}, isVLEN={}", nativeClass, tsize,
torder, isVLEN);
if (H5.H5Tcommitted(tid)) {
Expand Down Expand Up @@ -1155,14 +1155,14 @@ else if (nativeClass == HDF5Constants.H5T_OPAQUE) {
}
else if (nativeClass == HDF5Constants.H5T_COMPLEX) {
log.debug("fromNative(): datatypeClass is complex");
long tmptid = HDF5Constants.H5I_INVALID_HID;
long tmptid = HDF5Constants.H5I_INVALID_HID;
datatypeClass = CLASS_COMPLEX;
isComplex = true;
isComplex = true;
try {
log.trace("fromNative(): complex type");
tmptid = H5.H5Tget_super(tid);
tmptid = H5.H5Tget_super(tid);
int nativeBaseClass = H5.H5Tget_class(tmptid);
baseType = new H5Datatype(this.fileFormat, tmptid, this);
baseType = new H5Datatype(this.fileFormat, tmptid, this);
if (baseType == null) {
log.debug("fromNative(): Complex datatype has null base type");
throw new Exception("Datatype (Complex) has no base datatype");
Expand Down Expand Up @@ -1898,7 +1898,7 @@ else if (typeClass == CLASS_COMPLEX) {
else {
if (typeSize == NATIVE)
typeSize = H5.H5Tget_size(HDF5Constants.H5T_NATIVE_FLOAT);
data = new byte[(int) (numPoints * 2 * typeSize)];
data = new byte[(int)(numPoints * 2 * typeSize)];
}
}
else if ((typeClass == CLASS_OPAQUE) || (typeClass == CLASS_BITFIELD)) {
Expand Down
19 changes: 9 additions & 10 deletions src/org.hdfgroup.object/hdf/object/h5/H5ScalarDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,14 @@ public void init()
else
datatype = new H5Datatype(getFileFormat(), tid);

log.trace("init(): tid={} is tclass={} has isText={} : isNamed={} : isUnsigned={} ", tid,
datatype.getDatatypeClass(), ((H5Datatype)datatype).isText(),
datatype.isNamed(), datatype.isUnsigned());
log.trace(
"init(): tid={} is tclass={} has isText={} : isNamed={} : isUnsigned={} ",
tid, datatype.getDatatypeClass(), ((H5Datatype)datatype).isText(), datatype.isNamed(),
datatype.isUnsigned());
log.trace(
"init(): tid={} is tclass={} has isVLEN={} : isEnum={} : isStdRef={} : isRegRef={} : isComplex={}",
tid, datatype.getDatatypeClass(), datatype.isVLEN(), datatype.isEnum(),
((H5Datatype) datatype).isStdRef(), ((H5Datatype) datatype).isRegRef(),
((H5Datatype) datatype).isComplex());
"init(): tid={} is tclass={} has isVLEN={} : isEnum={} : isStdRef={} : isRegRef={} : isComplex={}",
tid, datatype.getDatatypeClass(), datatype.isVLEN(), datatype.isEnum(),
((H5Datatype)datatype).isStdRef(), ((H5Datatype)datatype).isRegRef(),
((H5Datatype)datatype).isComplex());
}
catch (Exception ex) {
log.debug("init(): failed to create datatype for dataset: ", ex);
Expand Down Expand Up @@ -2415,9 +2414,9 @@ else if (datatypeSize == 4)
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;
} // (datatypeClass)
}
Expand Down

0 comments on commit 22831e3

Please sign in to comment.