1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package MyGame 4 5 import java.nio.* 6 import kotlin.math.sign 7 import com.google.flatbuffers.* 8 9 @Suppress("unused") 10 class MonsterExtra : Table() { 11 __initnull12 fun __init(_i: Int, _bb: ByteBuffer) { 13 __reset(_i, _bb) 14 } __assignnull15 fun __assign(_i: Int, _bb: ByteBuffer) : MonsterExtra { 16 __init(_i, _bb) 17 return this 18 } 19 val d0 : Double 20 get() { 21 val o = __offset(4) 22 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NaN 23 } mutateD0null24 fun mutateD0(d0: Double) : Boolean { 25 val o = __offset(4) 26 return if (o != 0) { 27 bb.putDouble(o + bb_pos, d0) 28 true 29 } else { 30 false 31 } 32 } 33 val d1 : Double 34 get() { 35 val o = __offset(6) 36 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NaN 37 } mutateD1null38 fun mutateD1(d1: Double) : Boolean { 39 val o = __offset(6) 40 return if (o != 0) { 41 bb.putDouble(o + bb_pos, d1) 42 true 43 } else { 44 false 45 } 46 } 47 val d2 : Double 48 get() { 49 val o = __offset(8) 50 return if(o != 0) bb.getDouble(o + bb_pos) else Double.POSITIVE_INFINITY 51 } mutateD2null52 fun mutateD2(d2: Double) : Boolean { 53 val o = __offset(8) 54 return if (o != 0) { 55 bb.putDouble(o + bb_pos, d2) 56 true 57 } else { 58 false 59 } 60 } 61 val d3 : Double 62 get() { 63 val o = __offset(10) 64 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NEGATIVE_INFINITY 65 } mutateD3null66 fun mutateD3(d3: Double) : Boolean { 67 val o = __offset(10) 68 return if (o != 0) { 69 bb.putDouble(o + bb_pos, d3) 70 true 71 } else { 72 false 73 } 74 } 75 val f0 : Float 76 get() { 77 val o = __offset(12) 78 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NaN 79 } mutateF0null80 fun mutateF0(f0: Float) : Boolean { 81 val o = __offset(12) 82 return if (o != 0) { 83 bb.putFloat(o + bb_pos, f0) 84 true 85 } else { 86 false 87 } 88 } 89 val f1 : Float 90 get() { 91 val o = __offset(14) 92 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NaN 93 } mutateF1null94 fun mutateF1(f1: Float) : Boolean { 95 val o = __offset(14) 96 return if (o != 0) { 97 bb.putFloat(o + bb_pos, f1) 98 true 99 } else { 100 false 101 } 102 } 103 val f2 : Float 104 get() { 105 val o = __offset(16) 106 return if(o != 0) bb.getFloat(o + bb_pos) else Float.POSITIVE_INFINITY 107 } mutateF2null108 fun mutateF2(f2: Float) : Boolean { 109 val o = __offset(16) 110 return if (o != 0) { 111 bb.putFloat(o + bb_pos, f2) 112 true 113 } else { 114 false 115 } 116 } 117 val f3 : Float 118 get() { 119 val o = __offset(18) 120 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NEGATIVE_INFINITY 121 } mutateF3null122 fun mutateF3(f3: Float) : Boolean { 123 val o = __offset(18) 124 return if (o != 0) { 125 bb.putFloat(o + bb_pos, f3) 126 true 127 } else { 128 false 129 } 130 } dvecnull131 fun dvec(j: Int) : Double { 132 val o = __offset(20) 133 return if (o != 0) { 134 bb.getDouble(__vector(o) + j * 8) 135 } else { 136 0.0 137 } 138 } 139 val dvecLength : Int 140 get() { 141 val o = __offset(20); return if (o != 0) __vector_len(o) else 0 142 } 143 val dvecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(20, 8) dvecInByteBuffernull144 fun dvecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 20, 8) 145 fun mutateDvec(j: Int, dvec: Double) : Boolean { 146 val o = __offset(20) 147 return if (o != 0) { 148 bb.putDouble(__vector(o) + j * 8, dvec) 149 true 150 } else { 151 false 152 } 153 } fvecnull154 fun fvec(j: Int) : Float { 155 val o = __offset(22) 156 return if (o != 0) { 157 bb.getFloat(__vector(o) + j * 4) 158 } else { 159 0.0f 160 } 161 } 162 val fvecLength : Int 163 get() { 164 val o = __offset(22); return if (o != 0) __vector_len(o) else 0 165 } 166 val fvecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(22, 4) fvecInByteBuffernull167 fun fvecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 22, 4) 168 fun mutateFvec(j: Int, fvec: Float) : Boolean { 169 val o = __offset(22) 170 return if (o != 0) { 171 bb.putFloat(__vector(o) + j * 4, fvec) 172 true 173 } else { 174 false 175 } 176 } 177 companion object { validateVersionnull178 fun validateVersion() = Constants.FLATBUFFERS_2_0_0() 179 fun getRootAsMonsterExtra(_bb: ByteBuffer): MonsterExtra = getRootAsMonsterExtra(_bb, MonsterExtra()) 180 fun getRootAsMonsterExtra(_bb: ByteBuffer, obj: MonsterExtra): MonsterExtra { 181 _bb.order(ByteOrder.LITTLE_ENDIAN) 182 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 183 } MonsterExtraBufferHasIdentifiernull184 fun MonsterExtraBufferHasIdentifier(_bb: ByteBuffer) : Boolean = __has_identifier(_bb, "MONE") 185 fun createMonsterExtra(builder: FlatBufferBuilder, d0: Double, d1: Double, d2: Double, d3: Double, f0: Float, f1: Float, f2: Float, f3: Float, dvecOffset: Int, fvecOffset: Int) : Int { 186 builder.startTable(11) 187 addD3(builder, d3) 188 addD2(builder, d2) 189 addD1(builder, d1) 190 addD0(builder, d0) 191 addFvec(builder, fvecOffset) 192 addDvec(builder, dvecOffset) 193 addF3(builder, f3) 194 addF2(builder, f2) 195 addF1(builder, f1) 196 addF0(builder, f0) 197 return endMonsterExtra(builder) 198 } startMonsterExtranull199 fun startMonsterExtra(builder: FlatBufferBuilder) = builder.startTable(11) 200 fun addD0(builder: FlatBufferBuilder, d0: Double) = builder.addDouble(0, d0, Double.NaN) 201 fun addD1(builder: FlatBufferBuilder, d1: Double) = builder.addDouble(1, d1, Double.NaN) 202 fun addD2(builder: FlatBufferBuilder, d2: Double) = builder.addDouble(2, d2, Double.POSITIVE_INFINITY) 203 fun addD3(builder: FlatBufferBuilder, d3: Double) = builder.addDouble(3, d3, Double.NEGATIVE_INFINITY) 204 fun addF0(builder: FlatBufferBuilder, f0: Float) = builder.addFloat(4, f0, Double.NaN) 205 fun addF1(builder: FlatBufferBuilder, f1: Float) = builder.addFloat(5, f1, Double.NaN) 206 fun addF2(builder: FlatBufferBuilder, f2: Float) = builder.addFloat(6, f2, Double.POSITIVE_INFINITY) 207 fun addF3(builder: FlatBufferBuilder, f3: Float) = builder.addFloat(7, f3, Double.NEGATIVE_INFINITY) 208 fun addDvec(builder: FlatBufferBuilder, dvec: Int) = builder.addOffset(8, dvec, 0) 209 fun createDvecVector(builder: FlatBufferBuilder, data: DoubleArray) : Int { 210 builder.startVector(8, data.size, 8) 211 for (i in data.size - 1 downTo 0) { 212 builder.addDouble(data[i]) 213 } 214 return builder.endVector() 215 } startDvecVectornull216 fun startDvecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 217 fun addFvec(builder: FlatBufferBuilder, fvec: Int) = builder.addOffset(9, fvec, 0) 218 fun createFvecVector(builder: FlatBufferBuilder, data: FloatArray) : Int { 219 builder.startVector(4, data.size, 4) 220 for (i in data.size - 1 downTo 0) { 221 builder.addFloat(data[i]) 222 } 223 return builder.endVector() 224 } startFvecVectornull225 fun startFvecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 226 fun endMonsterExtra(builder: FlatBufferBuilder) : Int { 227 val o = builder.endTable() 228 return o 229 } finishMonsterExtraBuffernull230 fun finishMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset, "MONE") 231 fun finishSizePrefixedMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset, "MONE") 232 } 233 } 234