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

package AllWatchSerialize;

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

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

  public short type() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; }
  public Style style() { return style(new Style()); }
  public Style style(Style obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
  public Action action() { return action(new Action()); }
  public Action action(Action obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
  public byte attributesType() { int o = __offset(10); return o != 0 ? bb.get(o + bb_pos) : 0; }
  public Table attributes(Table obj) { int o = __offset(12); return o != 0 ? __union(obj, o) : null; }
  public String id() { int o = __offset(14); return o != 0 ? __string(o + bb_pos) : null; }
  public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(14, 1); }
  public ByteBuffer idInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 14, 1); }
  public Template children(int j) { return children(new Template(), j); }
  public Template children(Template obj, int j) { int o = __offset(16); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
  public int childrenLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }

  public static int createTemplate(FlatBufferBuilder builder,
      short type,
      int styleOffset,
      int actionOffset,
      byte attributes_type,
      int attributesOffset,
      int idOffset,
      int childrenOffset) {
    builder.startObject(7);
    Template.addChildren(builder, childrenOffset);
    Template.addId(builder, idOffset);
    Template.addAttributes(builder, attributesOffset);
    Template.addAction(builder, actionOffset);
    Template.addStyle(builder, styleOffset);
    Template.addType(builder, type);
    Template.addAttributesType(builder, attributes_type);
    return Template.endTemplate(builder);
  }

  public static void startTemplate(FlatBufferBuilder builder) { builder.startObject(7); }
  public static void addType(FlatBufferBuilder builder, short type) { builder.addShort(0, type, 0); }
  public static void addStyle(FlatBufferBuilder builder, int styleOffset) { builder.addOffset(1, styleOffset, 0); }
  public static void addAction(FlatBufferBuilder builder, int actionOffset) { builder.addOffset(2, actionOffset, 0); }
  public static void addAttributesType(FlatBufferBuilder builder, byte attributesType) { builder.addByte(3, attributesType, 0); }
  public static void addAttributes(FlatBufferBuilder builder, int attributesOffset) { builder.addOffset(4, attributesOffset, 0); }
  public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(5, idOffset, 0); }
  public static void addChildren(FlatBufferBuilder builder, int childrenOffset) { builder.addOffset(6, childrenOffset, 0); }
  public static int createChildrenVector(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 startChildrenVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
  public static int endTemplate(FlatBufferBuilder builder) {
    int o = builder.endObject();
    return o;
  }
}

