# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers

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

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

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

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

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

    # ColumnChunk
    def PageOffsets(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
        return 0

    # ColumnChunk
    def PageOffsetsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o)
        return 0

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

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

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

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

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

def ColumnChunkStart(builder): builder.StartObject(4)
def ColumnChunkAddPages(builder, pages): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pages), 0)
def ColumnChunkStartPagesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ColumnChunkAddPageOffsets(builder, pageOffsets): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(pageOffsets), 0)
def ColumnChunkStartPageOffsetsVector(builder, numElems): return builder.StartVector(8, numElems, 8)
def ColumnChunkAddPageMin(builder, pageMin): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(pageMin), 0)
def ColumnChunkStartPageMinVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ColumnChunkAddPageMax(builder, pageMax): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(pageMax), 0)
def ColumnChunkStartPageMaxVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ColumnChunkEnd(builder): return builder.EndObject()
