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

import * as flatbuffers from 'flatbuffers';

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

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

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

index():number {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint8(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, 6);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

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

static startAlphabetEntry(builder:flatbuffers.Builder) {
  builder.startObject(3);
}

static addIndex(builder:flatbuffers.Builder, index:number) {
  builder.addFieldInt8(0, index, 0);
}

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

static addValue(builder:flatbuffers.Builder, value:number) {
  builder.addFieldInt32(2, value, 0);
}

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

static createAlphabetEntry(builder:flatbuffers.Builder, index:number, letterOffset:flatbuffers.Offset, value:number):flatbuffers.Offset {
  AlphabetEntry.startAlphabetEntry(builder);
  AlphabetEntry.addIndex(builder, index);
  AlphabetEntry.addLetter(builder, letterOffset);
  AlphabetEntry.addValue(builder, value);
  return AlphabetEntry.endAlphabetEntry(builder);
}
}
