1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package com.google.flatbuffers.reflection; 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 EnumVal extends Table { ValidateVersion()24 public static void ValidateVersion() { Constants.FLATBUFFERS_25_1_24(); } getRootAsEnumVal(ByteBuffer _bb)25 public static EnumVal getRootAsEnumVal(ByteBuffer _bb) { return getRootAsEnumVal(_bb, new EnumVal()); } getRootAsEnumVal(ByteBuffer _bb, EnumVal obj)26 public static EnumVal getRootAsEnumVal(ByteBuffer _bb, EnumVal 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 EnumVal __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 29 name()30 public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } nameAsByteBuffer()31 public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } nameInByteBuffer(ByteBuffer _bb)32 public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } value()33 public long value() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } unionType()34 public com.google.flatbuffers.reflection.Type unionType() { return unionType(new com.google.flatbuffers.reflection.Type()); } unionType(com.google.flatbuffers.reflection.Type obj)35 public com.google.flatbuffers.reflection.Type unionType(com.google.flatbuffers.reflection.Type obj) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } documentation(int j)36 public String documentation(int j) { int o = __offset(12); return o != 0 ? __string(__vector(o) + j * 4) : null; } documentationLength()37 public int documentationLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; } documentationVector()38 public StringVector documentationVector() { return documentationVector(new StringVector()); } documentationVector(StringVector obj)39 public StringVector documentationVector(StringVector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } attributes(int j)40 public com.google.flatbuffers.reflection.KeyValue attributes(int j) { return attributes(new com.google.flatbuffers.reflection.KeyValue(), j); } attributes(com.google.flatbuffers.reflection.KeyValue obj, int j)41 public com.google.flatbuffers.reflection.KeyValue attributes(com.google.flatbuffers.reflection.KeyValue obj, int j) { int o = __offset(14); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } attributesLength()42 public int attributesLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; } attributesByKey(String key)43 public com.google.flatbuffers.reflection.KeyValue attributesByKey(String key) { int o = __offset(14); return o != 0 ? com.google.flatbuffers.reflection.KeyValue.__lookup_by_key(null, __vector(o), key, bb) : null; } attributesByKey(com.google.flatbuffers.reflection.KeyValue obj, String key)44 public com.google.flatbuffers.reflection.KeyValue attributesByKey(com.google.flatbuffers.reflection.KeyValue obj, String key) { int o = __offset(14); return o != 0 ? com.google.flatbuffers.reflection.KeyValue.__lookup_by_key(obj, __vector(o), key, bb) : null; } attributesVector()45 public com.google.flatbuffers.reflection.KeyValue.Vector attributesVector() { return attributesVector(new com.google.flatbuffers.reflection.KeyValue.Vector()); } attributesVector(com.google.flatbuffers.reflection.KeyValue.Vector obj)46 public com.google.flatbuffers.reflection.KeyValue.Vector attributesVector(com.google.flatbuffers.reflection.KeyValue.Vector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } 47 createEnumVal(FlatBufferBuilder builder, int nameOffset, long value, int unionTypeOffset, int documentationOffset, int attributesOffset)48 public static int createEnumVal(FlatBufferBuilder builder, 49 int nameOffset, 50 long value, 51 int unionTypeOffset, 52 int documentationOffset, 53 int attributesOffset) { 54 builder.startTable(6); 55 EnumVal.addValue(builder, value); 56 EnumVal.addAttributes(builder, attributesOffset); 57 EnumVal.addDocumentation(builder, documentationOffset); 58 EnumVal.addUnionType(builder, unionTypeOffset); 59 EnumVal.addName(builder, nameOffset); 60 return EnumVal.endEnumVal(builder); 61 } 62 startEnumVal(FlatBufferBuilder builder)63 public static void startEnumVal(FlatBufferBuilder builder) { builder.startTable(6); } addName(FlatBufferBuilder builder, int nameOffset)64 public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); } addValue(FlatBufferBuilder builder, long value)65 public static void addValue(FlatBufferBuilder builder, long value) { builder.addLong(value); builder.slot(1); } addUnionType(FlatBufferBuilder builder, int unionTypeOffset)66 public static void addUnionType(FlatBufferBuilder builder, int unionTypeOffset) { builder.addOffset(3, unionTypeOffset, 0); } addDocumentation(FlatBufferBuilder builder, int documentationOffset)67 public static void addDocumentation(FlatBufferBuilder builder, int documentationOffset) { builder.addOffset(4, documentationOffset, 0); } createDocumentationVector(FlatBufferBuilder builder, int[] data)68 public static int createDocumentationVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } startDocumentationVector(FlatBufferBuilder builder, int numElems)69 public static void startDocumentationVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } addAttributes(FlatBufferBuilder builder, int attributesOffset)70 public static void addAttributes(FlatBufferBuilder builder, int attributesOffset) { builder.addOffset(5, attributesOffset, 0); } createAttributesVector(FlatBufferBuilder builder, int[] data)71 public static int createAttributesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } startAttributesVector(FlatBufferBuilder builder, int numElems)72 public static void startAttributesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } endEnumVal(FlatBufferBuilder builder)73 public static int endEnumVal(FlatBufferBuilder builder) { 74 int o = builder.endTable(); 75 builder.required(o, 4); // name 76 return o; 77 } 78 79 @Override keysCompare(Integer o1, Integer o2, ByteBuffer _bb)80 protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) { 81 long val_1 = _bb.getLong(__offset(6, o1, _bb)); 82 long val_2 = _bb.getLong(__offset(6, o2, _bb)); 83 return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0; 84 } 85 __lookup_by_key(EnumVal obj, int vectorLocation, long key, ByteBuffer bb)86 public static EnumVal __lookup_by_key(EnumVal obj, int vectorLocation, long key, ByteBuffer bb) { 87 int span = bb.getInt(vectorLocation - 4); 88 int start = 0; 89 while (span != 0) { 90 int middle = span / 2; 91 int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb); 92 long val = bb.getLong(__offset(6, bb.capacity() - tableOffset, bb)); 93 int comp = val > key ? 1 : val < key ? -1 : 0; 94 if (comp > 0) { 95 span = middle; 96 } else if (comp < 0) { 97 middle++; 98 start += middle; 99 span -= middle; 100 } else { 101 return (obj == null ? new EnumVal() : obj).__assign(tableOffset, bb); 102 } 103 } 104 return null; 105 } 106 107 public static final class Vector extends BaseVector { __assign(int _vector, int _element_size, ByteBuffer _bb)108 public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } 109 get(int j)110 public EnumVal get(int j) { return get(new EnumVal(), j); } get(EnumVal obj, int j)111 public EnumVal get(EnumVal obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } getByKey(long key)112 public EnumVal getByKey(long key) { return __lookup_by_key(null, __vector(), key, bb); } getByKey(EnumVal obj, long key)113 public EnumVal getByKey(EnumVal obj, long key) { return __lookup_by_key(obj, __vector(), key, bb); } 114 } 115 } 116 117