summaryrefslogtreecommitdiffstats
path: root/java/src/hdf/hdf5lib/structs/H5O_token_t.java
blob: f0bb9787a2a2551737a3790201cebae591cde582 (plain)
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * 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 COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

package hdf.hdf5lib.structs;

import java.io.Serializable;
import java.util.Arrays;

import hdf.hdf5lib.HDF5Constants;

/**
 * Object token, which is a unique and permanent identifier, for an HDF5 object within a container.
 *
 */
public class H5O_token_t implements Serializable {
    private static final long serialVersionUID = -4754320605310155032L;
    /**
     * Tokens are unique and permanent identifiers that are
     *          used to reference HDF5 objects in a container.
     *          Use basic byte array to store the dat
     */
    public byte[] data;

    H5O_token_t (byte[] data) {
        this.data = data;
    }

    /**
     * Check if token data is undefined
     *
     * @return true if token data is undefined
     */
    public boolean isUndefined() {
        return this.equals(HDF5Constants.H5O_TOKEN_UNDEF);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;

        if (!(o instanceof H5O_token_t))
            return false;

        H5O_token_t token = (H5O_token_t) o;

        return Arrays.equals(this.data, token.data);
    }
}