1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package hdf.hdf5lib;
/**
* <p>
* This class is a container for the information reported about an HDF5 Object
* from the H5Gget_obj_info() method.
* <p>
* The fileno and objno fields contain four values which uniquely identify an
* object among those HDF5 files which are open: if all four values are the same
* between two objects, then the two objects are the same (provided both files
* are still open). The nlink field is the number of hard links to the object or
* zero when information is being returned about a symbolic link (symbolic links
* do not have hard links but all other objects always have at least one). The
* type field contains the type of the object, one of H5G_GROUP, H5G_DATASET, or
* H5G_LINK. The mtime field contains the modification time. If information is
* being returned about a symbolic link then linklen will be the length of the
* link value (the name of the pointed-to object with the null terminator);
* otherwise linklen will be zero. Other fields may be added to this structure
* in the future.
*/
public class HDF5GroupInfo {
long[] fileno;
long[] objno;
int nlink;
int type;
long mtime;
int linklen;
public HDF5GroupInfo() {
fileno = new long[2];
objno = new long[2];
nlink = -1;
type = -1;
mtime = 0;
linklen = 0;
}
/**
* Sets the HDF5 group information. Used by the JHI5.
*
* @param fn
* File id number
* @param on
* Object id number
* @param nl
* Number of links
* @param t
* Type of the object
* @param mt
* Modification time
* @param len
* Length of link
**/
public void setGroupInfo(long[] fn, long[] on, int nl, int t, long mt,
int len) {
fileno = fn;
objno = on;
nlink = nl;
type = t;
mtime = mt;
linklen = len;
}
/** Resets all the group information to defaults. */
public void reset() {
fileno[0] = 0;
fileno[1] = 0;
objno[0] = 0;
objno[1] = 0;
nlink = -1;
type = -1;
mtime = 0;
linklen = 0;
}
/* accessors */
public long[] getFileno() {
return fileno;
}
public long[] getObjno() {
return objno;
}
public int getType() {
return type;
}
public int getNlink() {
return nlink;
}
public long getMtime() {
return mtime;
}
public int getLinklen() {
return linklen;
}
/**
* The fileno and objno fields contain four values which uniquely identify
* an object among those HDF5 files.
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof HDF5GroupInfo)) {
return false;
}
HDF5GroupInfo target = (HDF5GroupInfo) obj;
if ((fileno[0] == target.fileno[0]) && (fileno[1] == target.fileno[1])
&& (objno[0] == target.objno[0])
&& (objno[1] == target.objno[1])) {
return true;
}
else {
return false;
}
}
/**
* Returns the object id.
*
* @return the object id
*/
public long getOID() {
return objno[0];
}
/**
* /** Converts this object to a String representation.
*
* @return a string representation of this object
*/
@Override
public String toString() {
String fileStr = "fileno=null";
String objStr = "objno=null";
if (fileno != null) {
fileStr = "fileno[0]=" + fileno[0] + ",fileno[1]=" + fileno[1];
}
if (objno != null) {
objStr = "objno[0]=" + objno[0] + ",objno[1]=" + objno[1];
}
return getClass().getName() + "[" + fileStr + "," + objStr + ",type="
+ type + ",nlink=" + nlink + ",mtime=" + mtime + ",linklen="
+ linklen + "]";
}
}
|