classdef (Hidden = true) FinalTarget < handle
% Class that represents a final target.

%   Copyright 2012-2013 The MathWorks, Inc.
    
    properties
        Comment
        TargetType
        
        % <PATH>/<NAME><EXT> : <DEPENDENCIES>
        %   <RULES>
        
        % <NAME> : <DEPENDENCIES>
        %   <RULES>
        
        TargetPath
        TargetName
        TargetExtension
        Dependencies
        Rules
    end
    
    methods
        % -----------------------------------------------------------------
        % Constructor
        % -----------------------------------------------------------------
        function h = FinalTarget()
            h.Rules = coder.make.util.OrderedList();
        end
        
        % -----------------------------------------------------------------
        % GET/SET METHODS
        % -----------------------------------------------------------------
        function set.Comment(h, value)
            if ~isempty(value) && ~ischar(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'Comment', class(h), 'string'))
            end
            h.Comment = value;
        end
        
        function set.TargetType(h, value)
            if ~isempty(value) && ~ischar(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'TargetType', class(h), 'string'))
            end
            h.TargetType = value;
        end
        
        function set.TargetPath(h, value)
            if ~isempty(value) && ~ischar(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'TargetPath', class(h), 'string'))
            end
            h.TargetPath = value;
        end
        
        function set.TargetName(h, value)
            if ~isempty(value) && ~ischar(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'TargetName', class(h), 'string'))
            end
            h.TargetName = value;
        end
        
        function set.TargetExtension(h, value)
            if ~isempty(value) && ~ischar(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'TargetExtension', class(h), 'string'))
            end
            h.TargetExtension = value;
        end
        
        function set.Dependencies(h, value)
            if ~isempty(value) && ~ischar(value) && ~iscell(value) %% ~iscellstr(value)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'DependencyPaths', class(h), 'string'))
            end
            h.Dependencies = value;
        end
        
        
        function set.Rules(h, value)
            validType = 'coder.make.util.OrderedList';
            if ~isempty(value) && ~isa(value, validType)
                error(message('CoderFoundation:utility:InvalidProperty', ...
                    'Rules', class(h), validType))
            end
            h.Rules = value;
        end
    end
end

