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 NestedStruct extends Struct { |
| 12 | public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } |
| 13 | public NestedStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } |
| 14 | |
| 15 | public int a(int j) { return bb.getInt(bb_pos + 0 + j * 4); } |
| 16 | public void mutateA(int j, int a) { bb.putInt(bb_pos + 0 + j * 4, a); } |
| 17 | public byte b() { return bb.get(bb_pos + 8); } |
| 18 | public void mutateB(byte b) { bb.put(bb_pos + 8, b); } |
| 19 | public byte c(int j) { return bb.get(bb_pos + 9 + j * 1); } |
| 20 | public void mutateC(int j, byte c) { bb.put(bb_pos + 9 + j * 1, c); } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 21 | public long d(int j) { return bb.getLong(bb_pos + 16 + j * 8); } |
| 22 | public void mutateD(int j, long d) { bb.putLong(bb_pos + 16 + j * 8, d); } |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 23 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 24 | public static int createNestedStruct(FlatBufferBuilder builder, int[] a, byte b, byte[] c, long[] d) { |
| 25 | builder.prep(8, 32); |
| 26 | for (int _idx0 = 2; _idx0 > 0; _idx0--) { |
| 27 | builder.putLong(d[_idx0-1]); |
| 28 | } |
| 29 | builder.pad(5); |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 30 | for (int _idx0 = 2; _idx0 > 0; _idx0--) { |
| 31 | builder.putByte(c[_idx0-1]); |
| 32 | } |
| 33 | builder.putByte(b); |
| 34 | for (int _idx0 = 2; _idx0 > 0; _idx0--) { |
| 35 | builder.putInt(a[_idx0-1]); |
| 36 | } |
| 37 | return builder.offset(); |
| 38 | } |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 39 | |
| 40 | public static final class Vector extends BaseVector { |
| 41 | public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } |
| 42 | |
| 43 | public NestedStruct get(int j) { return get(new NestedStruct(), j); } |
| 44 | public NestedStruct get(NestedStruct obj, int j) { return obj.__assign(__element(j), bb); } |
| 45 | } |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 46 | public NestedStructT unpack() { |
| 47 | NestedStructT _o = new NestedStructT(); |
| 48 | unpackTo(_o); |
| 49 | return _o; |
| 50 | } |
| 51 | public void unpackTo(NestedStructT _o) { |
| 52 | int[] _oA = _o.getA(); |
| 53 | for (int _j = 0; _j < 2; ++_j) { _oA[_j] = a(_j); } |
| 54 | byte _oB = b(); |
| 55 | _o.setB(_oB); |
| 56 | byte[] _oC = _o.getC(); |
| 57 | for (int _j = 0; _j < 2; ++_j) { _oC[_j] = c(_j); } |
| 58 | long[] _oD = _o.getD(); |
| 59 | for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j); } |
| 60 | } |
| 61 | public static int pack(FlatBufferBuilder builder, NestedStructT _o) { |
| 62 | if (_o == null) return 0; |
| 63 | int[] _a = _o.getA(); |
| 64 | byte[] _c = _o.getC(); |
| 65 | long[] _d = _o.getD(); |
| 66 | return createNestedStruct( |
| 67 | builder, |
| 68 | _a, |
| 69 | _o.getB(), |
| 70 | _c, |
| 71 | _d); |
| 72 | } |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 73 | } |
| 74 | |