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 /** 12 * an example documentation comment: monster object 13 */ 14 public final class Monster extends Table { getRootAsMonster(ByteBuffer _bb)15 public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } getRootAsMonster(ByteBuffer _bb, Monster obj)16 public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } MonsterBufferHasIdentifier(ByteBuffer _bb)17 public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); } __init(int _i, ByteBuffer _bb)18 public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; } __assign(int _i, ByteBuffer _bb)19 public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 20 pos()21 public Vec3 pos() { return pos(new Vec3()); } pos(Vec3 obj)22 public Vec3 pos(Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } mana()23 public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; } mutateMana(short mana)24 public boolean mutateMana(short mana) { int o = __offset(6); if (o != 0) { bb.putShort(o + bb_pos, mana); return true; } else { return false; } } hp()25 public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; } mutateHp(short hp)26 public boolean mutateHp(short hp) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, hp); return true; } else { return false; } } name()27 public String name() { int o = __offset(10); return o != 0 ? __string(o + bb_pos) : null; } nameAsByteBuffer()28 public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(10, 1); } inventory(int j)29 public int inventory(int j) { int o = __offset(14); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; } inventoryLength()30 public int inventoryLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; } inventoryAsByteBuffer()31 public ByteBuffer inventoryAsByteBuffer() { return __vector_as_bytebuffer(14, 1); } mutateInventory(int j, int inventory)32 public boolean mutateInventory(int j, int inventory) { int o = __offset(14); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)inventory); return true; } else { return false; } } color()33 public byte color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) : 8; } mutateColor(byte color)34 public boolean mutateColor(byte color) { int o = __offset(16); if (o != 0) { bb.put(o + bb_pos, color); return true; } else { return false; } } testType()35 public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; } mutateTestType(byte test_type)36 public boolean mutateTestType(byte test_type) { int o = __offset(18); if (o != 0) { bb.put(o + bb_pos, test_type); return true; } else { return false; } } test(Table obj)37 public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o) : null; } test4(int j)38 public Test test4(int j) { return test4(new Test(), j); } test4(Test obj, int j)39 public Test test4(Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; } test4Length()40 public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; } testarrayofstring(int j)41 public String testarrayofstring(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; } testarrayofstringLength()42 public int testarrayofstringLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; } 43 /** 44 * an example documentation comment: this will end up in the generated code 45 * multiline too 46 */ testarrayoftables(int j)47 public Monster testarrayoftables(int j) { return testarrayoftables(new Monster(), j); } testarrayoftables(Monster obj, int j)48 public Monster testarrayoftables(Monster obj, int j) { int o = __offset(26); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } testarrayoftablesLength()49 public int testarrayoftablesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; } testarrayoftablesByKey(String key)50 public Monster testarrayoftablesByKey(String key) { int o = __offset(26); return o != 0 ? Monster.__lookup_by_key(__vector(o), key, bb) : null; } enemy()51 public Monster enemy() { return enemy(new Monster()); } enemy(Monster obj)52 public Monster enemy(Monster obj) { int o = __offset(28); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } testnestedflatbuffer(int j)53 public int testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; } testnestedflatbufferLength()54 public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; } testnestedflatbufferAsByteBuffer()55 public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); } testnestedflatbufferAsMonster()56 public Monster testnestedflatbufferAsMonster() { return testnestedflatbufferAsMonster(new Monster()); } testnestedflatbufferAsMonster(Monster obj)57 public Monster testnestedflatbufferAsMonster(Monster obj) { int o = __offset(30); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; } mutateTestnestedflatbuffer(int j, int testnestedflatbuffer)58 public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)testnestedflatbuffer); return true; } else { return false; } } testempty()59 public Stat testempty() { return testempty(new Stat()); } testempty(Stat obj)60 public Stat testempty(Stat obj) { int o = __offset(32); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } testbool()61 public boolean testbool() { int o = __offset(34); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } mutateTestbool(boolean testbool)62 public boolean mutateTestbool(boolean testbool) { int o = __offset(34); if (o != 0) { bb.put(o + bb_pos, (byte)(testbool ? 1 : 0)); return true; } else { return false; } } testhashs32Fnv1()63 public int testhashs32Fnv1() { int o = __offset(36); return o != 0 ? bb.getInt(o + bb_pos) : 0; } mutateTesthashs32Fnv1(int testhashs32_fnv1)64 public boolean mutateTesthashs32Fnv1(int testhashs32_fnv1) { int o = __offset(36); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1); return true; } else { return false; } } testhashu32Fnv1()65 public long testhashu32Fnv1() { int o = __offset(38); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } mutateTesthashu32Fnv1(long testhashu32_fnv1)66 public boolean mutateTesthashu32Fnv1(long testhashu32_fnv1) { int o = __offset(38); if (o != 0) { bb.putInt(o + bb_pos, (int)testhashu32_fnv1); return true; } else { return false; } } testhashs64Fnv1()67 public long testhashs64Fnv1() { int o = __offset(40); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } mutateTesthashs64Fnv1(long testhashs64_fnv1)68 public boolean mutateTesthashs64Fnv1(long testhashs64_fnv1) { int o = __offset(40); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1); return true; } else { return false; } } testhashu64Fnv1()69 public long testhashu64Fnv1() { int o = __offset(42); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } mutateTesthashu64Fnv1(long testhashu64_fnv1)70 public boolean mutateTesthashu64Fnv1(long testhashu64_fnv1) { int o = __offset(42); if (o != 0) { bb.putLong(o + bb_pos, testhashu64_fnv1); return true; } else { return false; } } testhashs32Fnv1a()71 public int testhashs32Fnv1a() { int o = __offset(44); return o != 0 ? bb.getInt(o + bb_pos) : 0; } mutateTesthashs32Fnv1a(int testhashs32_fnv1a)72 public boolean mutateTesthashs32Fnv1a(int testhashs32_fnv1a) { int o = __offset(44); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1a); return true; } else { return false; } } testhashu32Fnv1a()73 public long testhashu32Fnv1a() { int o = __offset(46); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } mutateTesthashu32Fnv1a(long testhashu32_fnv1a)74 public boolean mutateTesthashu32Fnv1a(long testhashu32_fnv1a) { int o = __offset(46); if (o != 0) { bb.putInt(o + bb_pos, (int)testhashu32_fnv1a); return true; } else { return false; } } testhashs64Fnv1a()75 public long testhashs64Fnv1a() { int o = __offset(48); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } mutateTesthashs64Fnv1a(long testhashs64_fnv1a)76 public boolean mutateTesthashs64Fnv1a(long testhashs64_fnv1a) { int o = __offset(48); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1a); return true; } else { return false; } } testhashu64Fnv1a()77 public long testhashu64Fnv1a() { int o = __offset(50); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } mutateTesthashu64Fnv1a(long testhashu64_fnv1a)78 public boolean mutateTesthashu64Fnv1a(long testhashu64_fnv1a) { int o = __offset(50); if (o != 0) { bb.putLong(o + bb_pos, testhashu64_fnv1a); return true; } else { return false; } } testarrayofbools(int j)79 public boolean testarrayofbools(int j) { int o = __offset(52); return o != 0 ? 0!=bb.get(__vector(o) + j * 1) : false; } testarrayofboolsLength()80 public int testarrayofboolsLength() { int o = __offset(52); return o != 0 ? __vector_len(o) : 0; } testarrayofboolsAsByteBuffer()81 public ByteBuffer testarrayofboolsAsByteBuffer() { return __vector_as_bytebuffer(52, 1); } mutateTestarrayofbools(int j, boolean testarrayofbools)82 public boolean mutateTestarrayofbools(int j, boolean testarrayofbools) { int o = __offset(52); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)(testarrayofbools ? 1 : 0)); return true; } else { return false; } } testf()83 public float testf() { int o = __offset(54); return o != 0 ? bb.getFloat(o + bb_pos) : 3.14159f; } mutateTestf(float testf)84 public boolean mutateTestf(float testf) { int o = __offset(54); if (o != 0) { bb.putFloat(o + bb_pos, testf); return true; } else { return false; } } testf2()85 public float testf2() { int o = __offset(56); return o != 0 ? bb.getFloat(o + bb_pos) : 3.0f; } mutateTestf2(float testf2)86 public boolean mutateTestf2(float testf2) { int o = __offset(56); if (o != 0) { bb.putFloat(o + bb_pos, testf2); return true; } else { return false; } } testf3()87 public float testf3() { int o = __offset(58); return o != 0 ? bb.getFloat(o + bb_pos) : 0.0f; } mutateTestf3(float testf3)88 public boolean mutateTestf3(float testf3) { int o = __offset(58); if (o != 0) { bb.putFloat(o + bb_pos, testf3); return true; } else { return false; } } testarrayofstring2(int j)89 public String testarrayofstring2(int j) { int o = __offset(60); return o != 0 ? __string(__vector(o) + j * 4) : null; } testarrayofstring2Length()90 public int testarrayofstring2Length() { int o = __offset(60); return o != 0 ? __vector_len(o) : 0; } testarrayofsortedstruct(int j)91 public Ability testarrayofsortedstruct(int j) { return testarrayofsortedstruct(new Ability(), j); } testarrayofsortedstruct(Ability obj, int j)92 public Ability testarrayofsortedstruct(Ability obj, int j) { int o = __offset(62); return o != 0 ? obj.__assign(__vector(o) + j * 8, bb) : null; } testarrayofsortedstructLength()93 public int testarrayofsortedstructLength() { int o = __offset(62); return o != 0 ? __vector_len(o) : 0; } flex(int j)94 public int flex(int j) { int o = __offset(64); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; } flexLength()95 public int flexLength() { int o = __offset(64); return o != 0 ? __vector_len(o) : 0; } flexAsByteBuffer()96 public ByteBuffer flexAsByteBuffer() { return __vector_as_bytebuffer(64, 1); } mutateFlex(int j, int flex)97 public boolean mutateFlex(int j, int flex) { int o = __offset(64); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)flex); return true; } else { return false; } } test5(int j)98 public Test test5(int j) { return test5(new Test(), j); } test5(Test obj, int j)99 public Test test5(Test obj, int j) { int o = __offset(66); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; } test5Length()100 public int test5Length() { int o = __offset(66); return o != 0 ? __vector_len(o) : 0; } vectorOfLongs(int j)101 public long vectorOfLongs(int j) { int o = __offset(68); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; } vectorOfLongsLength()102 public int vectorOfLongsLength() { int o = __offset(68); return o != 0 ? __vector_len(o) : 0; } vectorOfLongsAsByteBuffer()103 public ByteBuffer vectorOfLongsAsByteBuffer() { return __vector_as_bytebuffer(68, 8); } mutateVectorOfLongs(int j, long vector_of_longs)104 public boolean mutateVectorOfLongs(int j, long vector_of_longs) { int o = __offset(68); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_longs); return true; } else { return false; } } vectorOfDoubles(int j)105 public double vectorOfDoubles(int j) { int o = __offset(70); return o != 0 ? bb.getDouble(__vector(o) + j * 8) : 0; } vectorOfDoublesLength()106 public int vectorOfDoublesLength() { int o = __offset(70); return o != 0 ? __vector_len(o) : 0; } vectorOfDoublesAsByteBuffer()107 public ByteBuffer vectorOfDoublesAsByteBuffer() { return __vector_as_bytebuffer(70, 8); } mutateVectorOfDoubles(int j, double vector_of_doubles)108 public boolean mutateVectorOfDoubles(int j, double vector_of_doubles) { int o = __offset(70); if (o != 0) { bb.putDouble(__vector(o) + j * 8, vector_of_doubles); return true; } else { return false; } } parentNamespaceTest()109 public MyGame.InParentNamespace parentNamespaceTest() { return parentNamespaceTest(new MyGame.InParentNamespace()); } parentNamespaceTest(MyGame.InParentNamespace obj)110 public MyGame.InParentNamespace parentNamespaceTest(MyGame.InParentNamespace obj) { int o = __offset(72); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } 111 startMonster(FlatBufferBuilder builder)112 public static void startMonster(FlatBufferBuilder builder) { builder.startObject(35); } addPos(FlatBufferBuilder builder, int posOffset)113 public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); } addMana(FlatBufferBuilder builder, short mana)114 public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); } addHp(FlatBufferBuilder builder, short hp)115 public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); } addName(FlatBufferBuilder builder, int nameOffset)116 public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(3, nameOffset, 0); } addInventory(FlatBufferBuilder builder, int inventoryOffset)117 public static void addInventory(FlatBufferBuilder builder, int inventoryOffset) { builder.addOffset(5, inventoryOffset, 0); } createInventoryVector(FlatBufferBuilder builder, byte[] data)118 public static int createInventoryVector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); } startInventoryVector(FlatBufferBuilder builder, int numElems)119 public static void startInventoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } addColor(FlatBufferBuilder builder, byte color)120 public static void addColor(FlatBufferBuilder builder, byte color) { builder.addByte(6, color, 8); } addTestType(FlatBufferBuilder builder, byte testType)121 public static void addTestType(FlatBufferBuilder builder, byte testType) { builder.addByte(7, testType, 0); } addTest(FlatBufferBuilder builder, int testOffset)122 public static void addTest(FlatBufferBuilder builder, int testOffset) { builder.addOffset(8, testOffset, 0); } addTest4(FlatBufferBuilder builder, int test4Offset)123 public static void addTest4(FlatBufferBuilder builder, int test4Offset) { builder.addOffset(9, test4Offset, 0); } startTest4Vector(FlatBufferBuilder builder, int numElems)124 public static void startTest4Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 2); } addTestarrayofstring(FlatBufferBuilder builder, int testarrayofstringOffset)125 public static void addTestarrayofstring(FlatBufferBuilder builder, int testarrayofstringOffset) { builder.addOffset(10, testarrayofstringOffset, 0); } createTestarrayofstringVector(FlatBufferBuilder builder, int[] data)126 public static int createTestarrayofstringVector(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(); } startTestarrayofstringVector(FlatBufferBuilder builder, int numElems)127 public static void startTestarrayofstringVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } addTestarrayoftables(FlatBufferBuilder builder, int testarrayoftablesOffset)128 public static void addTestarrayoftables(FlatBufferBuilder builder, int testarrayoftablesOffset) { builder.addOffset(11, testarrayoftablesOffset, 0); } createTestarrayoftablesVector(FlatBufferBuilder builder, int[] data)129 public static int createTestarrayoftablesVector(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(); } startTestarrayoftablesVector(FlatBufferBuilder builder, int numElems)130 public static void startTestarrayoftablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } addEnemy(FlatBufferBuilder builder, int enemyOffset)131 public static void addEnemy(FlatBufferBuilder builder, int enemyOffset) { builder.addOffset(12, enemyOffset, 0); } addTestnestedflatbuffer(FlatBufferBuilder builder, int testnestedflatbufferOffset)132 public static void addTestnestedflatbuffer(FlatBufferBuilder builder, int testnestedflatbufferOffset) { builder.addOffset(13, testnestedflatbufferOffset, 0); } createTestnestedflatbufferVector(FlatBufferBuilder builder, byte[] data)133 public static int createTestnestedflatbufferVector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); } startTestnestedflatbufferVector(FlatBufferBuilder builder, int numElems)134 public static void startTestnestedflatbufferVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } addTestempty(FlatBufferBuilder builder, int testemptyOffset)135 public static void addTestempty(FlatBufferBuilder builder, int testemptyOffset) { builder.addOffset(14, testemptyOffset, 0); } addTestbool(FlatBufferBuilder builder, boolean testbool)136 public static void addTestbool(FlatBufferBuilder builder, boolean testbool) { builder.addBoolean(15, testbool, false); } addTesthashs32Fnv1(FlatBufferBuilder builder, int testhashs32Fnv1)137 public static void addTesthashs32Fnv1(FlatBufferBuilder builder, int testhashs32Fnv1) { builder.addInt(16, testhashs32Fnv1, 0); } addTesthashu32Fnv1(FlatBufferBuilder builder, long testhashu32Fnv1)138 public static void addTesthashu32Fnv1(FlatBufferBuilder builder, long testhashu32Fnv1) { builder.addInt(17, (int)testhashu32Fnv1, (int)0L); } addTesthashs64Fnv1(FlatBufferBuilder builder, long testhashs64Fnv1)139 public static void addTesthashs64Fnv1(FlatBufferBuilder builder, long testhashs64Fnv1) { builder.addLong(18, testhashs64Fnv1, 0L); } addTesthashu64Fnv1(FlatBufferBuilder builder, long testhashu64Fnv1)140 public static void addTesthashu64Fnv1(FlatBufferBuilder builder, long testhashu64Fnv1) { builder.addLong(19, testhashu64Fnv1, 0L); } addTesthashs32Fnv1a(FlatBufferBuilder builder, int testhashs32Fnv1a)141 public static void addTesthashs32Fnv1a(FlatBufferBuilder builder, int testhashs32Fnv1a) { builder.addInt(20, testhashs32Fnv1a, 0); } addTesthashu32Fnv1a(FlatBufferBuilder builder, long testhashu32Fnv1a)142 public static void addTesthashu32Fnv1a(FlatBufferBuilder builder, long testhashu32Fnv1a) { builder.addInt(21, (int)testhashu32Fnv1a, (int)0L); } addTesthashs64Fnv1a(FlatBufferBuilder builder, long testhashs64Fnv1a)143 public static void addTesthashs64Fnv1a(FlatBufferBuilder builder, long testhashs64Fnv1a) { builder.addLong(22, testhashs64Fnv1a, 0L); } addTesthashu64Fnv1a(FlatBufferBuilder builder, long testhashu64Fnv1a)144 public static void addTesthashu64Fnv1a(FlatBufferBuilder builder, long testhashu64Fnv1a) { builder.addLong(23, testhashu64Fnv1a, 0L); } addTestarrayofbools(FlatBufferBuilder builder, int testarrayofboolsOffset)145 public static void addTestarrayofbools(FlatBufferBuilder builder, int testarrayofboolsOffset) { builder.addOffset(24, testarrayofboolsOffset, 0); } createTestarrayofboolsVector(FlatBufferBuilder builder, boolean[] data)146 public static int createTestarrayofboolsVector(FlatBufferBuilder builder, boolean[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addBoolean(data[i]); return builder.endVector(); } startTestarrayofboolsVector(FlatBufferBuilder builder, int numElems)147 public static void startTestarrayofboolsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } addTestf(FlatBufferBuilder builder, float testf)148 public static void addTestf(FlatBufferBuilder builder, float testf) { builder.addFloat(25, testf, 3.14159f); } addTestf2(FlatBufferBuilder builder, float testf2)149 public static void addTestf2(FlatBufferBuilder builder, float testf2) { builder.addFloat(26, testf2, 3.0f); } addTestf3(FlatBufferBuilder builder, float testf3)150 public static void addTestf3(FlatBufferBuilder builder, float testf3) { builder.addFloat(27, testf3, 0.0f); } addTestarrayofstring2(FlatBufferBuilder builder, int testarrayofstring2Offset)151 public static void addTestarrayofstring2(FlatBufferBuilder builder, int testarrayofstring2Offset) { builder.addOffset(28, testarrayofstring2Offset, 0); } createTestarrayofstring2Vector(FlatBufferBuilder builder, int[] data)152 public static int createTestarrayofstring2Vector(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(); } startTestarrayofstring2Vector(FlatBufferBuilder builder, int numElems)153 public static void startTestarrayofstring2Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } addTestarrayofsortedstruct(FlatBufferBuilder builder, int testarrayofsortedstructOffset)154 public static void addTestarrayofsortedstruct(FlatBufferBuilder builder, int testarrayofsortedstructOffset) { builder.addOffset(29, testarrayofsortedstructOffset, 0); } startTestarrayofsortedstructVector(FlatBufferBuilder builder, int numElems)155 public static void startTestarrayofsortedstructVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 4); } addFlex(FlatBufferBuilder builder, int flexOffset)156 public static void addFlex(FlatBufferBuilder builder, int flexOffset) { builder.addOffset(30, flexOffset, 0); } createFlexVector(FlatBufferBuilder builder, byte[] data)157 public static int createFlexVector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); } startFlexVector(FlatBufferBuilder builder, int numElems)158 public static void startFlexVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } addTest5(FlatBufferBuilder builder, int test5Offset)159 public static void addTest5(FlatBufferBuilder builder, int test5Offset) { builder.addOffset(31, test5Offset, 0); } startTest5Vector(FlatBufferBuilder builder, int numElems)160 public static void startTest5Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 2); } addVectorOfLongs(FlatBufferBuilder builder, int vectorOfLongsOffset)161 public static void addVectorOfLongs(FlatBufferBuilder builder, int vectorOfLongsOffset) { builder.addOffset(32, vectorOfLongsOffset, 0); } createVectorOfLongsVector(FlatBufferBuilder builder, long[] data)162 public static int createVectorOfLongsVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); } startVectorOfLongsVector(FlatBufferBuilder builder, int numElems)163 public static void startVectorOfLongsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } addVectorOfDoubles(FlatBufferBuilder builder, int vectorOfDoublesOffset)164 public static void addVectorOfDoubles(FlatBufferBuilder builder, int vectorOfDoublesOffset) { builder.addOffset(33, vectorOfDoublesOffset, 0); } createVectorOfDoublesVector(FlatBufferBuilder builder, double[] data)165 public static int createVectorOfDoublesVector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); } startVectorOfDoublesVector(FlatBufferBuilder builder, int numElems)166 public static void startVectorOfDoublesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } addParentNamespaceTest(FlatBufferBuilder builder, int parentNamespaceTestOffset)167 public static void addParentNamespaceTest(FlatBufferBuilder builder, int parentNamespaceTestOffset) { builder.addOffset(34, parentNamespaceTestOffset, 0); } endMonster(FlatBufferBuilder builder)168 public static int endMonster(FlatBufferBuilder builder) { 169 int o = builder.endObject(); 170 builder.required(o, 10); // name 171 return o; 172 } finishMonsterBuffer(FlatBufferBuilder builder, int offset)173 public static void finishMonsterBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset, "MONS"); } 174 175 @Override keysCompare(Integer o1, Integer o2, ByteBuffer _bb)176 protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) { return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb); } 177 __lookup_by_key(int vectorLocation, String key, ByteBuffer bb)178 public static Monster __lookup_by_key(int vectorLocation, String key, ByteBuffer bb) { 179 byte[] byteKey = key.getBytes(Table.UTF8_CHARSET.get()); 180 int span = bb.getInt(vectorLocation - 4); 181 int start = 0; 182 while (span != 0) { 183 int middle = span / 2; 184 int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb); 185 int comp = compareStrings(__offset(10, bb.capacity() - tableOffset, bb), byteKey, bb); 186 if (comp > 0) { 187 span = middle; 188 } else if (comp < 0) { 189 middle++; 190 start += middle; 191 span -= middle; 192 } else { 193 return new Monster().__assign(tableOffset, bb); 194 } 195 } 196 return null; 197 } 198 } 199 200