1// automatically generated by the FlatBuffers compiler, do not modify
2
3package MyGame.Example;
4
5import com.google.flatbuffers.BaseVector;
6import com.google.flatbuffers.BooleanVector;
7import com.google.flatbuffers.ByteVector;
8import com.google.flatbuffers.Constants;
9import com.google.flatbuffers.DoubleVector;
10import com.google.flatbuffers.FlatBufferBuilder;
11import com.google.flatbuffers.FloatVector;
12import com.google.flatbuffers.IntVector;
13import com.google.flatbuffers.LongVector;
14import com.google.flatbuffers.ShortVector;
15import com.google.flatbuffers.StringVector;
16import com.google.flatbuffers.Struct;
17import com.google.flatbuffers.Table;
18import com.google.flatbuffers.UnionVector;
19import java.nio.ByteBuffer;
20import java.nio.ByteOrder;
21
22@SuppressWarnings("unused")
23public final class Stat extends Table {
24 public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); }
25 public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
26 public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
27 public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
28 public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
29
30 public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
31 public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
32 public ByteBuffer idInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
33 public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
34 public boolean mutateVal(long val) { int o = __offset(6); if (o != 0) { bb.putLong(o + bb_pos, val); return true; } else { return false; } }
35 public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
36 public boolean mutateCount(int count) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, (short) count); return true; } else { return false; } }
37
38 public static int createStat(FlatBufferBuilder builder,
39 int idOffset,
40 long val,
41 int count) {
42 builder.startTable(3);
43 Stat.addVal(builder, val);
44 Stat.addId(builder, idOffset);
45 Stat.addCount(builder, count);
46 return Stat.endStat(builder);
47 }
48
49 public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); }
50 public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
51 public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
52 public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort((short) count); builder.slot(2); }
53 public static int endStat(FlatBufferBuilder builder) {
54 int o = builder.endTable();
55 return o;
56 }
57
58 @Override
59 protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) {
60 int val_1 = _bb.getShort(__offset(8, o1, _bb)) & 0xFFFF;
61 int val_2 = _bb.getShort(__offset(8, o2, _bb)) & 0xFFFF;
62 return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0;
63 }
64
65 public static Stat __lookup_by_key(Stat obj, int vectorLocation, int key, ByteBuffer bb) {
66 int span = bb.getInt(vectorLocation - 4);
67 int start = 0;
68 while (span != 0) {
69 int middle = span / 2;
70 int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
71 int val = bb.getShort(__offset(8, bb.capacity() - tableOffset, bb)) & 0xFFFF;
72 int comp = val > key ? 1 : val < key ? -1 : 0;
73 if (comp > 0) {
74 span = middle;
75 } else if (comp < 0) {
76 middle++;
77 start += middle;
78 span -= middle;
79 } else {
80 return (obj == null ? new Stat() : obj).__assign(tableOffset, bb);
81 }
82 }
83 return null;
84 }
85
86 public static final class Vector extends BaseVector {
87 public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
88
89 public Stat get(int j) { return get(new Stat(), j); }
90 public Stat get(Stat obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
91 public Stat getByKey(int key) { return __lookup_by_key(null, __vector(), key, bb); }
92 public Stat getByKey(Stat obj, int key) { return __lookup_by_key(obj, __vector(), key, bb); }
93 }
94 public StatT unpack() {
95 StatT _o = new StatT();
96 unpackTo(_o);
97 return _o;
98 }
99 public void unpackTo(StatT _o) {
100 String _oId = id();
101 _o.setId(_oId);
102 long _oVal = val();
103 _o.setVal(_oVal);
104 int _oCount = count();
105 _o.setCount(_oCount);
106 }
107 public static int pack(FlatBufferBuilder builder, StatT _o) {
108 if (_o == null) return 0;
109 int _id = _o.getId() == null ? 0 : builder.createString(_o.getId());
110 return createStat(
111 builder,
112 _id,
113 _o.getVal(),
114 _o.getCount());
115 }
116}
117
View as plain text