# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers

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

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

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

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

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

    # Statistics
    def Quantiles(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 .Quantiles import Quantiles
            obj = Quantiles()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

    # Statistics
    def Mode(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Modes import Modes
            obj = Modes()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Statistics
    def Min(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Extremes import Extremes
            obj = Extremes()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Statistics
    def Max(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Extremes import Extremes
            obj = Extremes()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def StatisticsStart(builder): builder.StartObject(5)
def StatisticsAddMoments(builder, moments): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(moments), 0)
def StatisticsStartMomentsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StatisticsAddQuantiles(builder, quantiles): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(quantiles), 0)
def StatisticsStartQuantilesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StatisticsAddMode(builder, mode): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(mode), 0)
def StatisticsAddMin(builder, min): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0)
def StatisticsAddMax(builder, max): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0)
def StatisticsEnd(builder): return builder.EndObject()
