summaryrefslogtreecommitdiffstats
path: root/java/examples/groups/H5Ex_G_Visit.java
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-04-22 15:24:27 (GMT)
committerGitHub <noreply@github.com>2022-04-22 15:24:27 (GMT)
commit974aefb8416d78b0687a54e5f72f21d0ca72ae2d (patch)
tree0fe4e4327b95c38f362ceace220d59cb08aa88a3 /java/examples/groups/H5Ex_G_Visit.java
parentf5042fd4d3549e9e3453ab99d81bb46f1688b240 (diff)
downloadhdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.zip
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.gz
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.bz2
Add java clang-format (#1672)
Diffstat (limited to 'java/examples/groups/H5Ex_G_Visit.java')
-rw-r--r--java/examples/groups/H5Ex_G_Visit.java53
1 files changed, 29 insertions, 24 deletions
diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java
index 790be80..d14ded6 100644
--- a/java/examples/groups/H5Ex_G_Visit.java
+++ b/java/examples/groups/H5Ex_G_Visit.java
@@ -20,22 +20,23 @@
************************************************************/
package examples.groups;
+import java.util.ArrayList;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
-import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_t;
import hdf.hdf5lib.structs.H5L_info_t;
import hdf.hdf5lib.structs.H5O_info_t;
-import java.util.ArrayList;
-
public class H5Ex_G_Visit {
private static String FILE = "groups/h5ex_g_visit.h5";
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
try {
(new H5Ex_G_Visit()).VisitGroup();
}
@@ -44,7 +45,8 @@ public class H5Ex_G_Visit {
}
}
- private void VisitGroup() throws Exception {
+ private void VisitGroup() throws Exception
+ {
long file_id = HDF5Constants.H5I_INVALID_HID;
@@ -55,15 +57,16 @@ public class H5Ex_G_Visit {
// Begin iteration using H5Ovisit
System.out.println("Objects in the file:");
H5O_iterate_opdata_t iter_data = new H5O_iter_data();
- H5O_iterate_t iter_cb = new H5O_iter_callback();
- H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data);
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
+ H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb,
+ iter_data);
System.out.println();
// Repeat the same process using H5Lvisit
H5L_iterate_opdata_t iter_data2 = new H5L_iter_data();
- H5L_iterate_t iter_cb2 = new H5L_iter_callback();
+ H5L_iterate_t iter_cb2 = new H5L_iter_callback();
System.out.println("Links in the file:");
- H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2);
-
+ H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2,
+ iter_data2);
}
catch (Exception e) {
e.printStackTrace();
@@ -76,15 +79,16 @@ public class H5Ex_G_Visit {
}
/************************************************************
- * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link points
- * to, and calls the operator function for H5Ovisit.
+ * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link
+ *points to, and calls the operator function for H5Ovisit.
************************************************************/
private class idata {
public String link_name = null;
- public int link_type = -1;
+ public int link_type = -1;
- idata(String name, int type) {
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -95,20 +99,21 @@ public class H5Ex_G_Visit {
}
private class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
- ((H5L_iter_data) op_data).iterdata.add(id);
+ ((H5L_iter_data)op_data).iterdata.add(id);
H5O_info_t infobuf;
int ret = 0;
try {
- // Get type of the object and display its name and type. The name of the object is passed to this
- // function by the Library.
- infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT);
+ // Get type of the object and display its name and type. The name of the object is passed to
+ // this function by the Library.
+ infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT);
H5O_iterate_t iter_cbO = new H5O_iter_callback();
H5O_iterate_opdata_t iter_dataO = new H5O_iter_data();
- ret = iter_cbO.callback(group, name, infobuf, iter_dataO);
+ ret = iter_cbO.callback(group, name, infobuf, iter_dataO);
}
catch (Exception e) {
e.printStackTrace();
@@ -123,9 +128,10 @@ public class H5Ex_G_Visit {
}
private class H5O_iter_callback implements H5O_iterate_t {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
- ((H5O_iter_data) op_data).iterdata.add(id);
+ ((H5O_iter_data)op_data).iterdata.add(id);
System.out.print("/"); /* Print root group in object path */
@@ -145,5 +151,4 @@ public class H5Ex_G_Visit {
return 0;
}
}
-
}