• 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 Referrable extends Table {
ValidateVersion()12   public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
getRootAsReferrable(ByteBuffer _bb)13   public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
getRootAsReferrable(ByteBuffer _bb, Referrable obj)14   public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable 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 Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
17 
id()18   public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
mutateId(long id)19   public boolean mutateId(long id) { int o = __offset(4); if (o != 0) { bb.putLong(o + bb_pos, id); return true; } else { return false; } }
20 
createReferrable(FlatBufferBuilder builder, long id)21   public static int createReferrable(FlatBufferBuilder builder,
22       long id) {
23     builder.startTable(1);
24     Referrable.addId(builder, id);
25     return Referrable.endReferrable(builder);
26   }
27 
startReferrable(FlatBufferBuilder builder)28   public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); }
addId(FlatBufferBuilder builder, long id)29   public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
endReferrable(FlatBufferBuilder builder)30   public static int endReferrable(FlatBufferBuilder builder) {
31     int o = builder.endTable();
32     return o;
33   }
34 
35   @Override
keysCompare(Integer o1, Integer o2, ByteBuffer _bb)36   protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) {
37     long val_1 = _bb.getLong(__offset(4, o1, _bb));
38     long val_2 = _bb.getLong(__offset(4, o2, _bb));
39     return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0;
40   }
41 
__lookup_by_key(Referrable obj, int vectorLocation, long key, ByteBuffer bb)42   public static Referrable __lookup_by_key(Referrable obj, int vectorLocation, long key, ByteBuffer bb) {
43     int span = bb.getInt(vectorLocation - 4);
44     int start = 0;
45     while (span != 0) {
46       int middle = span / 2;
47       int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
48       long val = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb));
49       int comp = val > key ? 1 : val < key ? -1 : 0;
50       if (comp > 0) {
51         span = middle;
52       } else if (comp < 0) {
53         middle++;
54         start += middle;
55         span -= middle;
56       } else {
57         return (obj == null ? new Referrable() : obj).__assign(tableOffset, bb);
58       }
59     }
60     return null;
61   }
62 
63   public static final class Vector extends BaseVector {
__assign(int _vector, int _element_size, ByteBuffer _bb)64     public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
65 
get(int j)66     public Referrable get(int j) { return get(new Referrable(), j); }
get(Referrable obj, int j)67     public Referrable get(Referrable obj, int j) {  return obj.__assign(__indirect(__element(j), bb), bb); }
getByKey(long key)68     public Referrable getByKey(long key) {  return __lookup_by_key(null, __vector(), key, bb); }
getByKey(Referrable obj, long key)69     public Referrable getByKey(Referrable obj, long key) {  return __lookup_by_key(obj, __vector(), key, bb); }
70   }
71 }
72 
73