classdef (Sealed=true) odeSensitivity

    properties
        ParameterIndices double {mustBeReal,mustBeInteger,mustBePositive}
        Jacobian = []
        InitialValue (:,:) double {mustBeReal,mustBeFinite}
        InitialSlope (:,:) double {mustBeReal,mustBeFinite}
    end

    methods
        function obj = odeSensitivity(nv)
            arguments
                nv.?odeSensitivity
            end
            names = fieldnames(nv);
            for k = 1:numel(names)
                obj.(names{k}) = nv.(names{k});
            end
        end

        function obj = set.ParameterIndices(obj,p)
            obj.ParameterIndices = p(:);
        end

        function obj = set.Jacobian(obj,J)
            if isempty(J)
                obj.Jacobian = [];
            elseif isa(J,'odeJacobian')
                obj.Jacobian = J;
            else
                obj.Jacobian = odeJacobian(Jacobian=J);
            end
        end
    end

    properties(Constant,Hidden)
        % 1.0 : Initial version (R2024a)
        Version = 1.0;
    end

    methods (Hidden)
        function b = saveobj(a)
            % Save all properties to struct.
            b = ode.assignProps(a,false,"odeSensitivity");
            % Keep track of versioning information.
            b.CompatibilityHelper.versionSavedFrom = a.Version;
            b.CompatibilityHelper.minCompatibleVersion = 1.0;
        end
    end

    methods (Hidden,Static)
        function b = loadobj(a)
            if odeSensitivity.Version < a.CompatibilityHelper.minCompatibleVersion
                warning(message("MATLAB:ode:MinVersionIncompat","odeSensitivity"));
                b = odeSensitivity;
                return
            end
            b = ode.assignProps(a,true,"odeSensitivity");
        end
    end

end

%    Copyright 2023 MathWorks, Inc.