Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | package MyGame.Example; |
| 4 | |
| 5 | import java.nio.*; |
| 6 | import java.lang.*; |
| 7 | import java.util.*; |
| 8 | import com.google.flatbuffers.*; |
| 9 | |
| 10 | @SuppressWarnings("unused") |
| 11 | public final class ArrayStruct extends Struct { |
| 12 | public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } |
| 13 | public ArrayStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } |
| 14 | |
| 15 | public float a() { return bb.getFloat(bb_pos + 0); } |
| 16 | public void mutateA(float a) { bb.putFloat(bb_pos + 0, a); } |
| 17 | public int b(int j) { return bb.getInt(bb_pos + 4 + j * 4); } |
| 18 | public void mutateB(int j, int b) { bb.putInt(bb_pos + 4 + j * 4, b); } |
| 19 | public byte c() { return bb.get(bb_pos + 64); } |
| 20 | public void mutateC(byte c) { bb.put(bb_pos + 64, c); } |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 21 | public MyGame.Example.NestedStruct d(int j) { return d(new MyGame.Example.NestedStruct(), j); } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 22 | public MyGame.Example.NestedStruct d(MyGame.Example.NestedStruct obj, int j) { return obj.__assign(bb_pos + 72 + j * 32, bb); } |
| 23 | public int e() { return bb.getInt(bb_pos + 136); } |
| 24 | public void mutateE(int e) { bb.putInt(bb_pos + 136, e); } |
| 25 | public long f(int j) { return bb.getLong(bb_pos + 144 + j * 8); } |
| 26 | public void mutateF(int j, long f) { bb.putLong(bb_pos + 144 + j * 8, f); } |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 27 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 28 | public static int createArrayStruct(FlatBufferBuilder builder, float a, int[] b, byte c, int[][] d_a, byte[] d_b, byte[][] d_c, long[][] d_d, int e, long[] f) { |
| 29 | builder.prep(8, 160); |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 30 | for (int _idx0 = 2; _idx0 > 0; _idx0--) { |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 31 | builder.putLong(f[_idx0-1]); |
| 32 | } |
| 33 | builder.pad(4); |
| 34 | builder.putInt(e); |
| 35 | for (int _idx0 = 2; _idx0 > 0; _idx0--) { |
| 36 | builder.prep(8, 32); |
| 37 | for (int _idx1 = 2; _idx1 > 0; _idx1--) { |
| 38 | builder.putLong(d_d[_idx0-1][_idx1-1]); |
| 39 | } |
| 40 | builder.pad(5); |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 41 | for (int _idx1 = 2; _idx1 > 0; _idx1--) { |
| 42 | builder.putByte(d_c[_idx0-1][_idx1-1]); |
| 43 | } |
| 44 | builder.putByte(d_b[_idx0-1]); |
| 45 | for (int _idx1 = 2; _idx1 > 0; _idx1--) { |
| 46 | builder.putInt(d_a[_idx0-1][_idx1-1]); |
| 47 | } |
| 48 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 49 | builder.pad(7); |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 50 | builder.putByte(c); |
| 51 | for (int _idx0 = 15; _idx0 > 0; _idx0--) { |
| 52 | builder.putInt(b[_idx0-1]); |
| 53 | } |
| 54 | builder.putFloat(a); |
| 55 | return builder.offset(); |
| 56 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 57 | |
| 58 | public static final class Vector extends BaseVector { |
| 59 | public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } |
| 60 | |
| 61 | public ArrayStruct get(int j) { return get(new ArrayStruct(), j); } |
| 62 | public ArrayStruct get(ArrayStruct obj, int j) { return obj.__assign(__element(j), bb); } |
| 63 | } |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 64 | public ArrayStructT unpack() { |
| 65 | ArrayStructT _o = new ArrayStructT(); |
| 66 | unpackTo(_o); |
| 67 | return _o; |
| 68 | } |
| 69 | public void unpackTo(ArrayStructT _o) { |
| 70 | float _oA = a(); |
| 71 | _o.setA(_oA); |
| 72 | int[] _oB = _o.getB(); |
| 73 | for (int _j = 0; _j < 15; ++_j) { _oB[_j] = b(_j); } |
| 74 | byte _oC = c(); |
| 75 | _o.setC(_oC); |
| 76 | MyGame.Example.NestedStructT[] _oD = _o.getD(); |
| 77 | for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j).unpack(); } |
| 78 | int _oE = e(); |
| 79 | _o.setE(_oE); |
| 80 | long[] _oF = _o.getF(); |
| 81 | for (int _j = 0; _j < 2; ++_j) { _oF[_j] = f(_j); } |
| 82 | } |
| 83 | public static int pack(FlatBufferBuilder builder, ArrayStructT _o) { |
| 84 | if (_o == null) return 0; |
| 85 | int[] _b = _o.getB(); |
| 86 | int[][] _d_a = new int[2][2]; |
| 87 | for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_a[idx0][idx1] = _o.getD()[idx0].getA()[idx1];}} |
| 88 | byte[] _d_b = new byte[2]; |
| 89 | for (int idx0 = 0; idx0 < 2; ++idx0) {_d_b[idx0] = _o.getD()[idx0].getB();} |
| 90 | byte[][] _d_c = new byte[2][2]; |
| 91 | for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_c[idx0][idx1] = _o.getD()[idx0].getC()[idx1];}} |
| 92 | long[][] _d_d = new long[2][2]; |
| 93 | for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_d[idx0][idx1] = _o.getD()[idx0].getD()[idx1];}} |
| 94 | long[] _f = _o.getF(); |
| 95 | return createArrayStruct( |
| 96 | builder, |
| 97 | _o.getA(), |
| 98 | _b, |
| 99 | _o.getC(), |
| 100 | _d_a, |
| 101 | _d_b, |
| 102 | _d_c, |
| 103 | _d_d, |
| 104 | _o.getE(), |
| 105 | _f); |
| 106 | } |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 107 | } |
| 108 | |