# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers

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

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

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

    # EvaluatedFunction
    def ValuesType(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

    # EvaluatedFunction
    def Values(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

    # EvaluatedFunction
    def DerivativesType(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

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

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

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

def EvaluatedFunctionStart(builder): builder.StartObject(5)
def EvaluatedFunctionAddValuesType(builder, valuesType): builder.PrependUint8Slot(0, valuesType, 0)
def EvaluatedFunctionAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
def EvaluatedFunctionAddDerivativesType(builder, derivativesType): builder.PrependUint8Slot(2, derivativesType, 0)
def EvaluatedFunctionAddDerivatives(builder, derivatives): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(derivatives), 0)
def EvaluatedFunctionAddErrors(builder, errors): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(errors), 0)
def EvaluatedFunctionStartErrorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def EvaluatedFunctionEnd(builder): return builder.EndObject()
