Develop clang format java (#1653)

This commit is contained in:
Allen Byrne
2022-04-19 13:08:09 -05:00
committed by GitHub
parent 32ef796e47
commit 03c3a54695
162 changed files with 13298 additions and 10029 deletions

View File

@@ -16,19 +16,19 @@
************************************************************/
package examples.groups;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.structs.H5G_info_t;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.structs.H5G_info_t;
public class H5Ex_G_Phase {
private static String FILE = "H5Ex_G_Phase.h5";
private static int MAX_GROUPS = 7;
private static String FILE = "H5Ex_G_Phase.h5";
private static int MAX_GROUPS = 7;
private static int MAX_COMPACT = 5;
private static int MIN_DENSE = 3;
private static int MIN_DENSE = 3;
enum H5G_storage {
H5G_STORAGE_TYPE_UNKNOWN(-1),
@@ -38,42 +38,39 @@ public class H5Ex_G_Phase {
private static final Map<Integer, H5G_storage> lookup = new HashMap<Integer, H5G_storage>();
static {
static
{
for (H5G_storage s : EnumSet.allOf(H5G_storage.class))
lookup.put(s.getCode(), s);
}
private int code;
H5G_storage(int layout_type) {
this.code = layout_type;
}
H5G_storage(int layout_type) { this.code = layout_type; }
public int getCode() {
return this.code;
}
public int getCode() { return this.code; }
public static H5G_storage get(int code) {
return lookup.get(code);
}
public static H5G_storage get(int code) { return lookup.get(code); }
}
private static void CreateGroup() {
long file_id = HDF5Constants.H5I_INVALID_HID;
long group_id = HDF5Constants.H5I_INVALID_HID;
private static void CreateGroup()
{
long file_id = HDF5Constants.H5I_INVALID_HID;
long group_id = HDF5Constants.H5I_INVALID_HID;
long subgroup_id = HDF5Constants.H5I_INVALID_HID;
long fapl_id = HDF5Constants.H5I_INVALID_HID;
long gcpl_id = HDF5Constants.H5I_INVALID_HID;
long fapl_id = HDF5Constants.H5I_INVALID_HID;
long gcpl_id = HDF5Constants.H5I_INVALID_HID;
H5G_info_t ginfo;
String name = "G0"; // Name of subgroup_id
int i;
// Set file access property list to allow the latest file format.This will allow the library to create new
// format groups.
// Set file access property list to allow the latest file format.This will allow the library to create
// new format groups.
try {
fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
if (fapl_id >= 0)
H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST);
H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST,
HDF5Constants.H5F_LIBVER_LATEST);
}
catch (Exception e) {
e.printStackTrace();
@@ -101,21 +98,23 @@ public class H5Ex_G_Phase {
// Create primary group.
try {
if ((file_id >= 0) && (gcpl_id >= 0))
group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id, HDF5Constants.H5P_DEFAULT);
group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id,
HDF5Constants.H5P_DEFAULT);
}
catch (Exception e) {
e.printStackTrace();
}
// Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is created.
// Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is
// created.
for (i = 1; i <= MAX_GROUPS; i++) {
// Define the subgroup name and create the subgroup.
char append = (char) (((char) i) + '0');
name = name + append; /* G1, G2, G3 etc. */
char append = (char)(((char)i) + '0');
name = name + append; /* G1, G2, G3 etc. */
try {
if (group_id >= 0) {
subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Gclose(subgroup_id);
}
}
@@ -127,7 +126,8 @@ public class H5Ex_G_Phase {
try {
if (group_id >= 0) {
ginfo = H5.H5Gget_info(group_id);
System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is ");
System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") +
": Storage type is ");
switch (H5G_storage.get(ginfo.storage_type)) {
case H5G_STORAGE_TYPE_COMPACT:
System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format
@@ -169,7 +169,8 @@ public class H5Ex_G_Phase {
try {
if (group_id >= 0) {
ginfo = H5.H5Gget_info(group_id);
System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is ");
System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") +
": Storage type is ");
switch (H5G_storage.get(ginfo.storage_type)) {
case H5G_STORAGE_TYPE_COMPACT:
System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format
@@ -228,11 +229,7 @@ public class H5Ex_G_Phase {
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
H5Ex_G_Phase.CreateGroup();
}
public static void main(String[] args) { H5Ex_G_Phase.CreateGroup(); }
}