• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Stat extends Table {
ValidateVersion()12   public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
getRootAsStat(ByteBuffer _bb)13   public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
getRootAsStat(ByteBuffer _bb, Stat obj)14   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)15   public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
__assign(int _i, ByteBuffer _bb)16   public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
17 
id()18   public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
idAsByteBuffer()19   public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
idInByteBuffer(ByteBuffer _bb)20   public ByteBuffer idInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
val()21   public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
mutateVal(long val)22   public boolean mutateVal(long val) { int o = __offset(6); if (o != 0) { bb.putLong(o + bb_pos, val); return true; } else { return false; } }
count()23   public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
mutateCount(int count)24   public boolean mutateCount(int count) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, (short)count); return true; } else { return false; } }
25 
createStat(FlatBufferBuilder builder, int idOffset, long val, int count)26   public static int createStat(FlatBufferBuilder builder,
27       int idOffset,
28       long val,
29       int count) {
30     builder.startTable(3);
31     Stat.addVal(builder, val);
32     Stat.addId(builder, idOffset);
33     Stat.addCount(builder, count);
34     return Stat.endStat(builder);
35   }
36 
startStat(FlatBufferBuilder builder)37   public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); }
addId(FlatBufferBuilder builder, int idOffset)38   public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
addVal(FlatBufferBuilder builder, long val)39   public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
addCount(FlatBufferBuilder builder, int count)40   public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short)count, (short)0); }
endStat(FlatBufferBuilder builder)41   public static int endStat(FlatBufferBuilder builder) {
42     int o = builder.endTable();
43     return o;
44   }
45 
46   @Override
keysCompare(Integer o1, Integer o2, ByteBuffer _bb)47   protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) {
48     int val_1 = _bb.getShort(__offset(8, o1, _bb)) & 0xFFFF;
49     int val_2 = _bb.getShort(__offset(8, o2, _bb)) & 0xFFFF;
50     return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0;
51   }
52 
__lookup_by_key(Stat obj, int vectorLocation, int key, ByteBuffer bb)53   public static Stat __lookup_by_key(Stat obj, int vectorLocation, int key, ByteBuffer bb) {
54     int span = bb.getInt(vectorLocation - 4);
55     int start = 0;
56     while (span != 0) {
57       int middle = span / 2;
58       int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
59       int val = bb.getShort(__offset(8, bb.capacity() - tableOffset, bb)) & 0xFFFF;
60       int comp = val > key ? 1 : val < key ? -1 : 0;
61       if (comp > 0) {
62         span = middle;
63       } else if (comp < 0) {
64         middle++;
65         start += middle;
66         span -= middle;
67       } else {
68         return (obj == null ? new Stat() : obj).__assign(tableOffset, bb);
69       }
70     }
71     return null;
72   }
73 
74   public static final class Vector extends BaseVector {
__assign(int _vector, int _element_size, ByteBuffer _bb)75     public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
76 
get(int j)77     public Stat get(int j) { return get(new Stat(), j); }
get(Stat obj, int j)78     public Stat get(Stat obj, int j) {  return obj.__assign(__indirect(__element(j), bb), bb); }
getByKey(int key)79     public Stat getByKey(int key) {  return __lookup_by_key(null, __vector(), key, bb); }
getByKey(Stat obj, int key)80     public Stat getByKey(Stat obj, int key) {  return __lookup_by_key(obj, __vector(), key, bb); }
81   }
82 }
83 
84