xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/Example/StructOfStructs.java (revision 890232f25432b36107d06881e0a25aaa6b473652)
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 StructOfStructs extends Struct {
__init(int _i, ByteBuffer _bb)12   public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
__assign(int _i, ByteBuffer _bb)13   public StructOfStructs __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
14 
a()15   public MyGame.Example.Ability a() { return a(new MyGame.Example.Ability()); }
a(MyGame.Example.Ability obj)16   public MyGame.Example.Ability a(MyGame.Example.Ability obj) { return obj.__assign(bb_pos + 0, bb); }
b()17   public MyGame.Example.Test b() { return b(new MyGame.Example.Test()); }
b(MyGame.Example.Test obj)18   public MyGame.Example.Test b(MyGame.Example.Test obj) { return obj.__assign(bb_pos + 8, bb); }
c()19   public MyGame.Example.Ability c() { return c(new MyGame.Example.Ability()); }
c(MyGame.Example.Ability obj)20   public MyGame.Example.Ability c(MyGame.Example.Ability obj) { return obj.__assign(bb_pos + 12, bb); }
21 
createStructOfStructs(FlatBufferBuilder builder, long a_id, long a_distance, short b_a, byte b_b, long c_id, long c_distance)22   public static int createStructOfStructs(FlatBufferBuilder builder, long a_id, long a_distance, short b_a, byte b_b, long c_id, long c_distance) {
23     builder.prep(4, 20);
24     builder.prep(4, 8);
25     builder.putInt((int) c_distance);
26     builder.putInt((int) c_id);
27     builder.prep(2, 4);
28     builder.pad(1);
29     builder.putByte(b_b);
30     builder.putShort(b_a);
31     builder.prep(4, 8);
32     builder.putInt((int) a_distance);
33     builder.putInt((int) a_id);
34     return builder.offset();
35   }
36 
37   public static final class Vector extends BaseVector {
__assign(int _vector, int _element_size, ByteBuffer _bb)38     public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
39 
get(int j)40     public StructOfStructs get(int j) { return get(new StructOfStructs(), j); }
get(StructOfStructs obj, int j)41     public StructOfStructs get(StructOfStructs obj, int j) {  return obj.__assign(__element(j), bb); }
42   }
unpack()43   public StructOfStructsT unpack() {
44     StructOfStructsT _o = new StructOfStructsT();
45     unpackTo(_o);
46     return _o;
47   }
unpackTo(StructOfStructsT _o)48   public void unpackTo(StructOfStructsT _o) {
49     a().unpackTo(_o.getA());
50     b().unpackTo(_o.getB());
51     c().unpackTo(_o.getC());
52   }
pack(FlatBufferBuilder builder, StructOfStructsT _o)53   public static int pack(FlatBufferBuilder builder, StructOfStructsT _o) {
54     if (_o == null) return 0;
55     int _a_id = _o.getA().getId();
56     int _a_distance = _o.getA().getDistance();
57     short _b_a = _o.getB().getA();
58     byte _b_b = _o.getB().getB();
59     int _c_id = _o.getC().getId();
60     int _c_distance = _o.getC().getDistance();
61     return createStructOfStructs(
62       builder,
63       _a_id,
64       _a_distance,
65       _b_a,
66       _b_b,
67       _c_id,
68       _c_distance);
69   }
70 }
71 
72