# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FBOutput

import tdw.flatbuffers

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

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

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

    # StaticCompositeObject
    def Id(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

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

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

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

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

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

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

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

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

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

    # StaticCompositeObject
    def MotorsLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

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

    # StaticCompositeObject
    def PrismaticJointsLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def StaticCompositeObjectStart(builder): builder.StartObject(7)
def StaticCompositeObjectAddId(builder, id): builder.PrependInt32Slot(0, id, 0)
def StaticCompositeObjectAddNonMachines(builder, nonMachines): builder.PrependUOffsetTRelativeSlot(1, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(nonMachines), 0)
def StaticCompositeObjectStartNonMachinesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectAddLights(builder, lights): builder.PrependUOffsetTRelativeSlot(2, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(lights), 0)
def StaticCompositeObjectStartLightsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectAddHinges(builder, hinges): builder.PrependUOffsetTRelativeSlot(3, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(hinges), 0)
def StaticCompositeObjectStartHingesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectAddSprings(builder, springs): builder.PrependUOffsetTRelativeSlot(4, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(springs), 0)
def StaticCompositeObjectStartSpringsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectAddMotors(builder, motors): builder.PrependUOffsetTRelativeSlot(5, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(motors), 0)
def StaticCompositeObjectStartMotorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectAddPrismaticJoints(builder, prismaticJoints): builder.PrependUOffsetTRelativeSlot(6, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(prismaticJoints), 0)
def StaticCompositeObjectStartPrismaticJointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StaticCompositeObjectEnd(builder): return builder.EndObject()
