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

import * as flatbuffers from 'flatbuffers';

export class TileRecord {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):TileRecord {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsTileRecord(bb:flatbuffers.ByteBuffer, obj?:TileRecord):TileRecord {
  return (obj || new TileRecord()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsTileRecord(bb:flatbuffers.ByteBuffer, obj?:TileRecord):TileRecord {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new TileRecord()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

row():number {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

col():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

letter():string|null
letter(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
letter(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

blank():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

static startTileRecord(builder:flatbuffers.Builder) {
  builder.startObject(4);
}

static addRow(builder:flatbuffers.Builder, row:number) {
  builder.addFieldInt32(0, row, 0);
}

static addCol(builder:flatbuffers.Builder, col:number) {
  builder.addFieldInt32(1, col, 0);
}

static addLetter(builder:flatbuffers.Builder, letterOffset:flatbuffers.Offset) {
  builder.addFieldOffset(2, letterOffset, 0);
}

static addBlank(builder:flatbuffers.Builder, blank:boolean) {
  builder.addFieldInt8(3, +blank, +false);
}

static endTileRecord(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createTileRecord(builder:flatbuffers.Builder, row:number, col:number, letterOffset:flatbuffers.Offset, blank:boolean):flatbuffers.Offset {
  TileRecord.startTileRecord(builder);
  TileRecord.addRow(builder, row);
  TileRecord.addCol(builder, col);
  TileRecord.addLetter(builder, letterOffset);
  TileRecord.addBlank(builder, blank);
  return TileRecord.endTileRecord(builder);
}
}
