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

package Universe

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

type Universe struct {
	_tab flatbuffers.Table
}

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

func FinishUniverseBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.Finish(offset)
}

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

func FinishSizePrefixedUniverseBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.FinishSizePrefixed(offset)
}

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

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

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

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

func (rcv *Universe) Galaxies(obj *Galaxy, 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 *Universe) GalaxiesLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func UniverseStart(builder *flatbuffers.Builder) {
	builder.StartObject(2)
}
func UniverseAddAge(builder *flatbuffers.Builder, age float64) {
	builder.PrependFloat64Slot(0, age, 0.0)
}
func UniverseAddGalaxies(builder *flatbuffers.Builder, galaxies flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(galaxies), 0)
}
func UniverseStartGalaxiesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func UniverseEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
