# automatically generated by the FlatBuffers compiler, do not modify

# namespace: schema

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

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

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

    @classmethod
    def GetRootAsNode(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # Node
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Node
    def Children(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # Node
    def ChildrenAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint32Flags, o)
        return 0

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

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

    # Node
    def Hyperplanes(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.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # Node
    def HyperplanesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

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

    # Node
    def BucketIdsToChildren(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
        return 0

    # Node
    def BucketIdsToChildrenAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint64Flags, o)
        return 0

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

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

    # Node
    def Centroid(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # Node
    def CentroidAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # Node
    def CentroidLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Node
    def CentroidIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Node
    def NumItems(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # Node
    def BatchIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

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

    # Node
    def Eigenvalues(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # Node
    def EigenvaluesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # Node
    def EigenvaluesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Node
    def EigenvaluesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

def NodeStart(builder):
    builder.StartObject(9)

def Start(builder):
    NodeStart(builder)

def NodeAddChildren(builder, children):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(children), 0)

def AddChildren(builder, children):
    NodeAddChildren(builder, children)

def NodeStartChildrenVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)

def StartChildrenVector(builder, numElems):
    return NodeStartChildrenVector(builder, numElems)

def NodeAddHyperplanes(builder, hyperplanes):
    builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(hyperplanes), 0)

def AddHyperplanes(builder, hyperplanes):
    NodeAddHyperplanes(builder, hyperplanes)

def NodeStartHyperplanesVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)

def StartHyperplanesVector(builder, numElems):
    return NodeStartHyperplanesVector(builder, numElems)

def NodeAddNumBits(builder, numBits):
    builder.PrependUint8Slot(2, numBits, 0)

def AddNumBits(builder, numBits):
    NodeAddNumBits(builder, numBits)

def NodeAddBucketIdsToChildren(builder, bucketIdsToChildren):
    builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(bucketIdsToChildren), 0)

def AddBucketIdsToChildren(builder, bucketIdsToChildren):
    NodeAddBucketIdsToChildren(builder, bucketIdsToChildren)

def NodeStartBucketIdsToChildrenVector(builder, numElems):
    return builder.StartVector(8, numElems, 8)

def StartBucketIdsToChildrenVector(builder, numElems):
    return NodeStartBucketIdsToChildrenVector(builder, numElems)

def NodeAddCentroid(builder, centroid):
    builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(centroid), 0)

def AddCentroid(builder, centroid):
    NodeAddCentroid(builder, centroid)

def NodeStartCentroidVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)

def StartCentroidVector(builder, numElems):
    return NodeStartCentroidVector(builder, numElems)

def NodeAddNumItems(builder, numItems):
    builder.PrependUint32Slot(5, numItems, 0)

def AddNumItems(builder, numItems):
    NodeAddNumItems(builder, numItems)

def NodeAddBatchIndex(builder, batchIndex):
    builder.PrependInt32Slot(6, batchIndex, -1)

def AddBatchIndex(builder, batchIndex):
    NodeAddBatchIndex(builder, batchIndex)

def NodeAddDepth(builder, depth):
    builder.PrependUint8Slot(7, depth, 0)

def AddDepth(builder, depth):
    NodeAddDepth(builder, depth)

def NodeAddEigenvalues(builder, eigenvalues):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(eigenvalues), 0)

def AddEigenvalues(builder, eigenvalues):
    NodeAddEigenvalues(builder, eigenvalues)

def NodeStartEigenvaluesVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)

def StartEigenvaluesVector(builder, numElems):
    return NodeStartEigenvaluesVector(builder, numElems)

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

def End(builder):
    return NodeEnd(builder)
