# automatically generated by the FlatBuffers compiler, do not modify

# namespace: API

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class GranuleData(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsGranuleData(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = GranuleData()
        x.Init(buf, n + offset)
        return x

    # GranuleData
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # GranuleData
    def Fields(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # GranuleData
    def FieldsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # GranuleData
    def FieldsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # GranuleData
    def Buckets(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from SEAScope.API.DataBucket import DataBucket
            obj = DataBucket()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # GranuleData
    def BucketsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # GranuleData
    def BucketsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # GranuleData
    def FloatFields(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # GranuleData
    def FloatFieldsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # GranuleData
    def FloatFieldsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        return o == 0

    # GranuleData
    def FloatBuckets(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from SEAScope.API.FloatDataBucket import FloatDataBucket
            obj = FloatDataBucket()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # GranuleData
    def FloatBucketsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # GranuleData
    def FloatBucketsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

def GranuleDataStart(builder): builder.StartObject(4)
def GranuleDataAddFields(builder, fields): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(fields), 0)
def GranuleDataStartFieldsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def GranuleDataAddBuckets(builder, buckets): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(buckets), 0)
def GranuleDataStartBucketsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def GranuleDataAddFloatFields(builder, floatFields): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(floatFields), 0)
def GranuleDataStartFloatFieldsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def GranuleDataAddFloatBuckets(builder, floatBuckets): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(floatBuckets), 0)
def GranuleDataStartFloatBucketsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def GranuleDataEnd(builder): return builder.EndObject()
