File: AttributeEntryDescriptorRecord.java

package info (click to toggle)
jcdf 1.2.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: java: 5,315; makefile: 198; sh: 98
file content (90 lines) | stat: -rw-r--r-- 2,711 bytes parent folder | download | duplicates (2)
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
package uk.ac.bristol.star.cdf.record;

import java.io.IOException;

/**
 * Abstract superclass for CDF Attribute Entry Descriptor Records.
 * Two concrete subclasses exist for AzEDRs and AgrEDRs.
 *
 * @author   Mark Taylor
 * @since    19 Jun 2013
 */
public abstract class AttributeEntryDescriptorRecord extends Record {

    @CdfField @OffsetField public final long aedrNext;
    @CdfField public final int attrNum;
    @CdfField public final int dataType;
    @CdfField public final int num;
    @CdfField public final int numElems;
    @CdfField public final int rfuA;
    @CdfField public final int rfuB;
    @CdfField public final int rfuC;
    @CdfField public final int rfuD;
    @CdfField public final int rfuE;
    private final long valueOffset_;

    /**
     * Constructor.
     *
     * @param  plan  basic record info
     * @param  abbrev  abbreviated name for record type
     * @param  recordType  record type code
     */
    private AttributeEntryDescriptorRecord( RecordPlan plan, String abbrev,
                                            int recordType )
            throws IOException {
        super( plan, abbrev, recordType );
        Buf buf = plan.getBuf();
        Pointer ptr = plan.createContentPointer();
        this.aedrNext = buf.readOffset( ptr );
        this.attrNum = buf.readInt( ptr );
        this.dataType = buf.readInt( ptr );
        this.num = buf.readInt( ptr );
        this.numElems = buf.readInt( ptr );
        this.rfuA = buf.readInt( ptr );
        this.rfuB = buf.readInt( ptr );
        this.rfuC = buf.readInt( ptr );
        this.rfuD = buf.readInt( ptr );
        this.rfuE = buf.readInt( ptr );
        valueOffset_ = ptr.get();
    }

    /**
     * Returns the file offset at which this record's Value field starts.
     *
     * @return  file offset of Value field
     */
    public long getValueOffset() {
        return valueOffset_;
    }

    /**
     * Field data for CDF record of type Attribute g/rEntry Descriptor Record.
     */
    public static class GrVariant extends AttributeEntryDescriptorRecord {

        /**
         * Constructor.
         *
         * @param  plan   basic record information
         */
        public GrVariant( RecordPlan plan ) throws IOException {
            super( plan, "AgrEDR", 5 );
        }
    }

    /**
     * Field data for CDF record of type Attribute zEntry Descriptor Record.
     */
    public static class ZVariant extends AttributeEntryDescriptorRecord {

        /**
         * Constructor.
         *
         * @param  plan   basic record information
         */
        public ZVariant( RecordPlan plan ) throws IOException {
            super( plan, "AzEDR", 9 );
        }
    }
}