diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-04-22 15:24:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 15:24:27 (GMT) |
commit | 974aefb8416d78b0687a54e5f72f21d0ca72ae2d (patch) | |
tree | 0fe4e4327b95c38f362ceace220d59cb08aa88a3 /java/examples/datatypes/H5Ex_T_BitAttribute.java | |
parent | f5042fd4d3549e9e3453ab99d81bb46f1688b240 (diff) | |
download | hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.zip hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.gz hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.bz2 |
Add java clang-format (#1672)
Diffstat (limited to 'java/examples/datatypes/H5Ex_T_BitAttribute.java')
-rw-r--r-- | java/examples/datatypes/H5Ex_T_BitAttribute.java | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java index 9b33ca5..3ad643a 100644 --- a/java/examples/datatypes/H5Ex_T_BitAttribute.java +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -24,19 +24,20 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_BitAttribute { - private static String FILENAME = "H5Ex_T_BitAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_BitAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data = new int[DIM0][DIM1]; // Initialize data. @@ -44,15 +45,15 @@ public class H5Ex_T_BitAttribute { for (int jndx = 0; jndx < DIM1; jndx++) { dset_data[indx][jndx] = 0; dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ - dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ - dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ } // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -63,7 +64,8 @@ public class H5Ex_T_BitAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -84,8 +86,9 @@ public class H5Ex_T_BitAttribute { // Create the attribute and write the array data to it. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -134,15 +137,15 @@ public class H5Ex_T_BitAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data; // Open an existing file. @@ -165,7 +168,7 @@ public class H5Ex_T_BitAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -190,7 +193,7 @@ public class H5Ex_T_BitAttribute { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (dims[1])]; + dset_data = new int[(int)dims[0]][(int)(dims[1])]; // Read data. try { @@ -249,10 +252,10 @@ public class H5Ex_T_BitAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_BitAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -260,5 +263,4 @@ public class H5Ex_T_BitAttribute { // data using malloc(). H5Ex_T_BitAttribute.ReadDataset(); } - } |