Home | History | Annotate | Download | only in Example
      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 public final class Stat extends Table {
     12   public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
     13   public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
     14   public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
     15   public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
     16 
     17   public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
     18   public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
     19   public ByteBuffer idInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
     20   public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
     21   public boolean mutateVal(long val) { int o = __offset(6); if (o != 0) { bb.putLong(o + bb_pos, val); return true; } else { return false; } }
     22   public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
     23   public boolean mutateCount(int count) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, (short)count); return true; } else { return false; } }
     24 
     25   public static int createStat(FlatBufferBuilder builder,
     26       int idOffset,
     27       long val,
     28       int count) {
     29     builder.startObject(3);
     30     Stat.addVal(builder, val);
     31     Stat.addId(builder, idOffset);
     32     Stat.addCount(builder, count);
     33     return Stat.endStat(builder);
     34   }
     35 
     36   public static void startStat(FlatBufferBuilder builder) { builder.startObject(3); }
     37   public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
     38   public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
     39   public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short)count, (short)0); }
     40   public static int endStat(FlatBufferBuilder builder) {
     41     int o = builder.endObject();
     42     return o;
     43   }
     44 }
     45 
     46