xref: /aosp_15_r20/external/flatbuffers/tests/union_vector/FallingTub.java (revision 890232f25432b36107d06881e0a25aaa6b473652)
1 // automatically generated by the FlatBuffers compiler, do not modify
2 
3 import java.nio.*;
4 import java.lang.*;
5 import java.util.*;
6 import com.google.flatbuffers.*;
7 
8 @SuppressWarnings("unused")
9 public final class FallingTub extends Struct {
__init(int _i, ByteBuffer _bb)10   public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
__assign(int _i, ByteBuffer _bb)11   public FallingTub __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
12 
weight()13   public int weight() { return bb.getInt(bb_pos + 0); }
mutateWeight(int weight)14   public void mutateWeight(int weight) { bb.putInt(bb_pos + 0, weight); }
15 
createFallingTub(FlatBufferBuilder builder, int weight)16   public static int createFallingTub(FlatBufferBuilder builder, int weight) {
17     builder.prep(4, 4);
18     builder.putInt(weight);
19     return builder.offset();
20   }
21 
22   public static final class Vector extends BaseVector {
__assign(int _vector, int _element_size, ByteBuffer _bb)23     public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
24 
get(int j)25     public FallingTub get(int j) { return get(new FallingTub(), j); }
get(FallingTub obj, int j)26     public FallingTub get(FallingTub obj, int j) {  return obj.__assign(__element(j), bb); }
27   }
unpack()28   public FallingTubT unpack() {
29     FallingTubT _o = new FallingTubT();
30     unpackTo(_o);
31     return _o;
32   }
unpackTo(FallingTubT _o)33   public void unpackTo(FallingTubT _o) {
34     int _oWeight = weight();
35     _o.setWeight(_oWeight);
36   }
pack(FlatBufferBuilder builder, FallingTubT _o)37   public static int pack(FlatBufferBuilder builder, FallingTubT _o) {
38     if (_o == null) return 0;
39     return createFallingTub(
40       builder,
41       _o.getWeight());
42   }
43 }
44 
45