# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers


class RegularBinning(object):
    __slots__ = ["_tab"]

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

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

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

    # RegularBinning
    def Interval(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = o + self._tab.Pos
            from .RealInterval import RealInterval

            obj = RealInterval()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # RegularBinning
    def Overflow(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = o + self._tab.Pos
            from .RealOverflow import RealOverflow

            obj = RealOverflow()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # RegularBinning
    def Circular(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return bool(
                self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
            )
        return False


def RegularBinningStart(builder):
    builder.StartObject(4)


def RegularBinningAddNum(builder, num):
    builder.PrependUint64Slot(0, num, 0)


def RegularBinningAddInterval(builder, interval):
    builder.PrependStructSlot(
        1, flatbuffers.number_types.UOffsetTFlags.py_type(interval), 0
    )


def RegularBinningAddOverflow(builder, overflow):
    builder.PrependStructSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(overflow), 0
    )


def RegularBinningAddCircular(builder, circular):
    builder.PrependBoolSlot(3, circular, 0)


def RegularBinningEnd(builder):
    return builder.EndObject()
