blob: f1548578aeae2aeb47213dde388cd4a579ae5d90 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2
3package MyGame.Example;
4
5import java.nio.*;
6import java.lang.*;
7import java.util.*;
8import com.google.flatbuffers.*;
9
10@SuppressWarnings("unused")
11public final class Referrable extends Table {
12 public static void ValidateVersion() { Constants.FLATBUFFERS_1_11_1(); }
13 public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
14 public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
15 public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
16 public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
17
18 public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
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
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
28 public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); }
29 public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
30 public static int endReferrable(FlatBufferBuilder builder) {
31 int o = builder.endTable();
32 return o;
33 }
34
35 @Override
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
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