1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package DictionaryLookup; 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 LongFloatEntry extends Table { ValidateVersion()12 public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); } getRootAsLongFloatEntry(ByteBuffer _bb)13 public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb) { return getRootAsLongFloatEntry(_bb, new LongFloatEntry()); } getRootAsLongFloatEntry(ByteBuffer _bb, LongFloatEntry obj)14 public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb, LongFloatEntry 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 LongFloatEntry __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 17 key()18 public long key() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } value()19 public float value() { int o = __offset(6); return o != 0 ? bb.getFloat(o + bb_pos) : 0.0f; } 20 createLongFloatEntry(FlatBufferBuilder builder, long key, float value)21 public static int createLongFloatEntry(FlatBufferBuilder builder, 22 long key, 23 float value) { 24 builder.startTable(2); 25 LongFloatEntry.addKey(builder, key); 26 LongFloatEntry.addValue(builder, value); 27 return LongFloatEntry.endLongFloatEntry(builder); 28 } 29 startLongFloatEntry(FlatBufferBuilder builder)30 public static void startLongFloatEntry(FlatBufferBuilder builder) { builder.startTable(2); } addKey(FlatBufferBuilder builder, long key)31 public static void addKey(FlatBufferBuilder builder, long key) { builder.addLong(key); builder.slot(0); } addValue(FlatBufferBuilder builder, float value)32 public static void addValue(FlatBufferBuilder builder, float value) { builder.addFloat(1, value, 0.0f); } endLongFloatEntry(FlatBufferBuilder builder)33 public static int endLongFloatEntry(FlatBufferBuilder builder) { 34 int o = builder.endTable(); 35 return o; 36 } 37 38 @Override keysCompare(Integer o1, Integer o2, ByteBuffer _bb)39 protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) { 40 long val_1 = _bb.getLong(__offset(4, o1, _bb)); 41 long val_2 = _bb.getLong(__offset(4, o2, _bb)); 42 return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0; 43 } 44 __lookup_by_key(LongFloatEntry obj, int vectorLocation, long key, ByteBuffer bb)45 public static LongFloatEntry __lookup_by_key(LongFloatEntry obj, int vectorLocation, long key, ByteBuffer bb) { 46 int span = bb.getInt(vectorLocation - 4); 47 int start = 0; 48 while (span != 0) { 49 int middle = span / 2; 50 int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb); 51 long val = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb)); 52 int comp = val > key ? 1 : val < key ? -1 : 0; 53 if (comp > 0) { 54 span = middle; 55 } else if (comp < 0) { 56 middle++; 57 start += middle; 58 span -= middle; 59 } else { 60 return (obj == null ? new LongFloatEntry() : obj).__assign(tableOffset, bb); 61 } 62 } 63 return null; 64 } 65 66 public static final class Vector extends BaseVector { __assign(int _vector, int _element_size, ByteBuffer _bb)67 public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } 68 get(int j)69 public LongFloatEntry get(int j) { return get(new LongFloatEntry(), j); } get(LongFloatEntry obj, int j)70 public LongFloatEntry get(LongFloatEntry obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } getByKey(long key)71 public LongFloatEntry getByKey(long key) { return __lookup_by_key(null, __vector(), key, bb); } getByKey(LongFloatEntry obj, long key)72 public LongFloatEntry getByKey(LongFloatEntry obj, long key) { return __lookup_by_key(obj, __vector(), key, bb); } 73 } 74 } 75 76