1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package MyGame.Example; 4 5 import com.google.flatbuffers.BaseVector; 6 import com.google.flatbuffers.BooleanVector; 7 import com.google.flatbuffers.ByteVector; 8 import com.google.flatbuffers.Constants; 9 import com.google.flatbuffers.DoubleVector; 10 import com.google.flatbuffers.FlatBufferBuilder; 11 import com.google.flatbuffers.FloatVector; 12 import com.google.flatbuffers.IntVector; 13 import com.google.flatbuffers.LongVector; 14 import com.google.flatbuffers.ShortVector; 15 import com.google.flatbuffers.StringVector; 16 import com.google.flatbuffers.Struct; 17 import com.google.flatbuffers.Table; 18 import com.google.flatbuffers.UnionVector; 19 import java.nio.ByteBuffer; 20 import java.nio.ByteOrder; 21 22 @SuppressWarnings("unused") 23 public final class Stat extends Table { ValidateVersion()24 public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); } getRootAsStat(ByteBuffer _bb)25 public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); } getRootAsStat(ByteBuffer _bb, Stat obj)26 public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } __init(int _i, ByteBuffer _bb)27 public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } __assign(int _i, ByteBuffer _bb)28 public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 29 id()30 public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } idAsByteBuffer()31 public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } idInByteBuffer(ByteBuffer _bb)32 public ByteBuffer idInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } val()33 public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } mutateVal(long val)34 public boolean mutateVal(long val) { int o = __offset(6); if (o != 0) { bb.putLong(o + bb_pos, val); return true; } else { return false; } } count()35 public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; } mutateCount(int count)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 createStat(FlatBufferBuilder builder, int idOffset, long val, int count)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 startStat(FlatBufferBuilder builder)49 public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); } addId(FlatBufferBuilder builder, int idOffset)50 public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); } addVal(FlatBufferBuilder builder, long val)51 public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); } addCount(FlatBufferBuilder builder, int count)52 public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort((short) count); builder.slot(2); } endStat(FlatBufferBuilder builder)53 public static int endStat(FlatBufferBuilder builder) { 54 int o = builder.endTable(); 55 return o; 56 } 57 58 @Override keysCompare(Integer o1, Integer o2, ByteBuffer _bb)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 __lookup_by_key(Stat obj, int vectorLocation, int key, ByteBuffer bb)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 { __assign(int _vector, int _element_size, ByteBuffer _bb)87 public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } 88 get(int j)89 public Stat get(int j) { return get(new Stat(), j); } get(Stat obj, int j)90 public Stat get(Stat obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } getByKey(int key)91 public Stat getByKey(int key) { return __lookup_by_key(null, __vector(), key, bb); } getByKey(Stat obj, int key)92 public Stat getByKey(Stat obj, int key) { return __lookup_by_key(obj, __vector(), key, bb); } 93 } unpack()94 public StatT unpack() { 95 StatT _o = new StatT(); 96 unpackTo(_o); 97 return _o; 98 } unpackTo(StatT _o)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 } pack(FlatBufferBuilder builder, StatT _o)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 118