// automatically generated by the FlatBuffers compiler, do not modify

package motis;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
public final class Statistics extends Table {
  public static Statistics getRootAsStatistics(ByteBuffer _bb) { return getRootAsStatistics(_bb, new Statistics()); }
  public static Statistics getRootAsStatistics(ByteBuffer _bb, Statistics obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
  public Statistics __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }

  public String category() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
  public ByteBuffer categoryAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
  public StatisticsEntry entries(int j) { return entries(new StatisticsEntry(), j); }
  public StatisticsEntry entries(StatisticsEntry obj, int j) { int o = __offset(6); return o != 0 ? obj.__init(__indirect(__vector(o) + j * 4), bb) : null; }
  public int entriesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }

  public static int createStatistics(FlatBufferBuilder builder,
      int categoryOffset,
      int entriesOffset) {
    builder.startObject(2);
    Statistics.addEntries(builder, entriesOffset);
    Statistics.addCategory(builder, categoryOffset);
    return Statistics.endStatistics(builder);
  }

  public static void startStatistics(FlatBufferBuilder builder) { builder.startObject(2); }
  public static void addCategory(FlatBufferBuilder builder, int categoryOffset) { builder.addOffset(0, categoryOffset, 0); }
  public static void addEntries(FlatBufferBuilder builder, int entriesOffset) { builder.addOffset(1, entriesOffset, 0); }
  public static int createEntriesVector(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(); }
  public static void startEntriesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
  public static int endStatistics(FlatBufferBuilder builder) {
    int o = builder.endObject();
    builder.required(o, 4);  // category
    return o;
  }
};

