// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package gamma_api

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type ResultItem struct {
	_tab flatbuffers.Table
}

func GetRootAsResultItem(buf []byte, offset flatbuffers.UOffsetT) *ResultItem {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &ResultItem{}
	x.Init(buf, n+offset)
	return x
}

func GetSizePrefixedRootAsResultItem(buf []byte, offset flatbuffers.UOffsetT) *ResultItem {
	n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
	x := &ResultItem{}
	x.Init(buf, n+offset+flatbuffers.SizeUint32)
	return x
}

func (rcv *ResultItem) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *ResultItem) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *ResultItem) Score() float64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetFloat64(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *ResultItem) MutateScore(n float64) bool {
	return rcv._tab.MutateFloat64Slot(4, n)
}

func (rcv *ResultItem) Attributes(obj *Attribute, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *ResultItem) AttributesLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func (rcv *ResultItem) Extra() []byte {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.ByteVector(o + rcv._tab.Pos)
	}
	return nil
}

func ResultItemStart(builder *flatbuffers.Builder) {
	builder.StartObject(3)
}
func ResultItemAddScore(builder *flatbuffers.Builder, score float64) {
	builder.PrependFloat64Slot(0, score, 0.0)
}
func ResultItemAddAttributes(builder *flatbuffers.Builder, attributes flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(attributes), 0)
}
func ResultItemStartAttributesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func ResultItemAddExtra(builder *flatbuffers.Builder, extra flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(extra), 0)
}
func ResultItemEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
