Monster.java revision b3ee52c0a7f32a642787b9373cef6e7467880dc1
1// automatically generated, do not modify 2 3package MyGame.Example; 4 5import java.nio.*; 6import java.lang.*; 7import java.util.*; 8import flatbuffers.*; 9 10public class Monster extends Table { 11 public static Monster getRootAsMonster(ByteBuffer _bb, int offset) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (new Monster()).__init(_bb.getInt(offset) + offset, _bb); } 12 public Monster __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } 13 public Vec3 pos() { return pos(new Vec3()); } 14 public Vec3 pos(Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__init(o + bb_pos, bb) : null; } 15 public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; } 16 public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; } 17 public String name() { int o = __offset(10); return o != 0 ? __string(o) : null; } 18 public byte inventory(int j) { int o = __offset(14); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; } 19 public int inventoryLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; } 20 public byte color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) : 2; } 21 public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; } 22 public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o) : null; } 23 public Test test4(int j) { return test4(new Test(), j); } 24 public Test test4(Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__init(__vector(o) + j * 4, bb) : null; } 25 public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; } 26 public String testarrayofstring(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; } 27 public int testarrayofstringLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; } 28 /// an example documentation comment: this will end up in the generated code multiline too 29 public Monster testarrayoftables(int j) { return testarrayoftables(new Monster(), j); } 30 public Monster testarrayoftables(Monster obj, int j) { int o = __offset(26); return o != 0 ? obj.__init(__indirect(__vector(o) + j * 4), bb) : null; } 31 public int testarrayoftablesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; } 32 33 public static void startMonster(FlatBufferBuilder builder) { builder.startObject(12); } 34 public static void addPos(FlatBufferBuilder builder, int pos) { builder.addStruct(0, pos, 0); } 35 public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); } 36 public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); } 37 public static void addName(FlatBufferBuilder builder, int name) { builder.addOffset(3, name, 0); } 38 public static void addInventory(FlatBufferBuilder builder, int inventory) { builder.addOffset(5, inventory, 0); } 39 public static void startInventoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems); } 40 public static void addColor(FlatBufferBuilder builder, byte color) { builder.addByte(6, color, 2); } 41 public static void addTestType(FlatBufferBuilder builder, byte testType) { builder.addByte(7, testType, 0); } 42 public static void addTest(FlatBufferBuilder builder, int test) { builder.addOffset(8, test, 0); } 43 public static void addTest4(FlatBufferBuilder builder, int test4) { builder.addOffset(9, test4, 0); } 44 public static void startTest4Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems); } 45 public static void addTestarrayofstring(FlatBufferBuilder builder, int testarrayofstring) { builder.addOffset(10, testarrayofstring, 0); } 46 public static void startTestarrayofstringVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems); } 47 public static void addTestarrayoftables(FlatBufferBuilder builder, int testarrayoftables) { builder.addOffset(11, testarrayoftables, 0); } 48 public static void startTestarrayoftablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems); } 49 public static int endMonster(FlatBufferBuilder builder) { return builder.endObject(); } 50}; 51 52