# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers

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

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

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

    # Moments
    def SumwxnType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Moments
    def Sumwxn(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Moments
    def N(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # Moments
    def Weightpower(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

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

def MomentsStart(builder): builder.StartObject(5)
def MomentsAddSumwxnType(builder, sumwxnType): builder.PrependUint8Slot(0, sumwxnType, 0)
def MomentsAddSumwxn(builder, sumwxn): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(sumwxn), 0)
def MomentsAddN(builder, n): builder.PrependInt8Slot(2, n, 0)
def MomentsAddWeightpower(builder, weightpower): builder.PrependInt8Slot(3, weightpower, 0)
def MomentsAddFilter(builder, filter): builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(filter), 0)
def MomentsEnd(builder): return builder.EndObject()
