classdef VariableID < matlab.mixin.SetGet & matlab.mixin.Heterogeneous & matlab.mixin.Copyable
    %modelpack.VariableID class
    %    modelpack.VariableID properties:
    %       Description - Property is of type 'ustring'
    %
    %    modelpack.VariableID methods:
    %       getDimensions - Returns the dimensions of the object identified by THIS.
    %       getFullName - Returns the unique full name of the object identified by THIS.
    %       getName - Returns the name of the object identified by THIS.
    %       getPath - Returns the relative path to the object identified by THIS.
    %       isSame - Default implementation for determining whether a given VariableID
    %       setDimensions - Sets the dimensions of the object identified by THIS.
    %       setName - Sets the name of the object identified by THIS.
    %       setPath - Sets the relative path to the object identified by THIS.

    % Copyright 2000-2023 The MathWorks, Inc.

    properties (Access=protected, SetObservable)
        %VERSION Property is of type 'double'
        Version = 0;
    end

    properties (SetObservable)
        %DESCRIPTION Property is of type 'ustring'
        Description = '';
    end


    methods
        function set.Description(obj,value)
            % DataType = 'ustring'
            % no cell string checks yet'
            obj.Description = value;
        end

        function set.Version(obj,value)
            % DataType = 'double'
            validateattributes(value,{'numeric'}, {'scalar'},'','Version')
            value = double(value); %  convert to double
            obj.Version = value;
        end

    end   % set and get functions

    methods  % public methods
        function dims = getDimensions(this)
            % GETDIMENSIONS Returns the dimensions of the object identified by THIS.
            %
            % DIMS is a 1xn vector of integer numbers (cell array of vectors if THIS is
            % an object array).

            n = numel(this);

            if n == 1
                dims = [];
            else
                dims = cell(n,1);
                dims(:) = {[]};
            end

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % getDimensions

        function name = getFullName(this)
            % GETFULLNAME Returns the unique full name of the object identified by THIS.
            %
            % NAME is a string (cell array of strings if THIS is an object array).
            %
            % ATTN: Model name is not part of the full name.

            n = numel(this);

            if n == 1
                name = '';
            else
                name = cell(n,1);
                name(:) = {''};
            end

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % getFullName

        function name = getName(this)
            % GETNAME Returns the name of the object identified by THIS.
            %
            % NAME is a string (cell array of strings if THIS is an object array).

            n = numel(this);

            if n == 1
                name = '';
            else
                name = cell(n,1);
                name(:) = {''};
            end

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % getName

        function path = getPath(this)
            % GETPATH Returns the relative path to the object identified by THIS.
            %
            % PATH is a string (cell array of strings if THIS is an object array).
            %
            % ATTN: Model name is not part of the path name.

            n = numel(this);

            if n == 1
                path = '';
            else
                path = cell(n,1);
                path(:) = {''};
            end

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % getPath

        function flag = isSame(this, ID)
            % ISSAME Default implementation for determining whether a given VariableID
            % object identifies the same object as THIS.  Equivalent to operator
            % overloading for "==".

            flag = false;

            if (length(this(:)) == length(ID(:))) && ...
                    isa(ID, class(this)) && ...
                    all( strcmp(ID.getFullName, this.getFullName) ) && ...
                    isequal(ID.getDimensions, this.getDimensions)
                flag = true;
            end

        end  % isSame

        function setDimensions(~, ~)
            % SETDIMENSIONS Sets the dimensions of the object identified by THIS.
            %
            % DIMS is a 1xn vector of integer numbers.

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % setDimensions

        function setName(~, ~)
            % SETNAME Sets the name of the object identified by THIS.
            %
            % NAME is a string.

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % setName

        function setPath(~, ~)
            % SETPATH Sets the relative path to the object identified by THIS.
            %
            % PATH is a string.
            %
            % ATTN: Model name is not part of the path name.

            warning(message('Controllib:general:AbstractMethodMustBeOverloaded'));

        end  % setPath

    end  % public methods

end  % classdef

% LocalWords:  GETDIMENSIONS xn SETDIMENSIONS SETPATH
