~seh999/jcog/proto3

« back to all changes in this revision

Viewing changes to spacetime/src/opencog/spacetime/io/out/u3d/u3dencoding/DataBlock.java

  • Committer: SeH
  • Date: 2009-09-19 22:59:48 UTC
  • Revision ID: seh999@gmail.com-20090919225948-q3ab80xa57i74mm6
start of major jReality refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package opencog.spacetime.io.out.u3d.u3dencoding;
 
2
 
 
3
public class DataBlock {
 
4
        
 
5
        private long[] 
 
6
            data = null,
 
7
            metaData = null;
 
8
        private long 
 
9
                dataSize = 0, 
 
10
                metaDataSize = 0,
 
11
                priority = 0,
 
12
                blockType = 0;
 
13
        
 
14
        
 
15
        public DataBlock() {
 
16
 
 
17
        }
 
18
 
 
19
        public long getDataSize() {
 
20
                return this.dataSize;
 
21
        }
 
22
 
 
23
        public void setDataSize(long value) {
 
24
                this.dataSize = value;
 
25
                //allocate data buffer for block.
 
26
                //the data is generally aligned to byte values
 
27
                //but array is 4 bytes values . . .
 
28
                if ((this.dataSize & 0x3) == 0)
 
29
                        this.data = new long[(int)value >> 2];
 
30
                else
 
31
                        this.data = new long[((int)value >> 2) + 1];
 
32
        }
 
33
 
 
34
        public long[] getData() {
 
35
                return this.data;
 
36
        }
 
37
 
 
38
        public void setData(long[] value) {
 
39
                this.data = value;
 
40
        }
 
41
 
 
42
        public long getMetaDataSize() {
 
43
                return this.metaDataSize;
 
44
        }
 
45
 
 
46
        public void setMetaDataSize(long value) {
 
47
                this.metaDataSize = value;
 
48
                //allocate data buffer for block.
 
49
                //the data is generally aligned to byte values
 
50
                //but array is 4 bytes values . . .
 
51
                if ((this.metaDataSize & 0x3) == 0)
 
52
                        this.metaData = new long[(int)value >> 2];
 
53
                else
 
54
                        this.metaData = new long[((int)value >> 2) + 1];
 
55
        }
 
56
 
 
57
        public long[] getMetaData() {
 
58
                return this.metaData;
 
59
        }
 
60
 
 
61
        public void setMetaData(long[] value) {
 
62
                if (value.length == this.metaData.length) {
 
63
                        System.arraycopy(value, 0, this.metaData, 0, value.length);
 
64
                }
 
65
        }
 
66
 
 
67
        public long getBlockType() {
 
68
                return this.blockType;
 
69
        }
 
70
 
 
71
        public void setBlockType(long value) {
 
72
                this.blockType = value;
 
73
        }
 
74
 
 
75
        public long getPriority() {
 
76
                return this.priority;
 
77
        }
 
78
 
 
79
        public void setPriority(long value) {
 
80
                this.priority = value;
 
81
        }
 
82
 
 
83
}