%DisplayHelperInvalid - helper class for displaying invalid distributed/GPU
%arrays

% Copyright 2009-2019 The MathWorks, Inc.

classdef DisplayHelperInvalid < parallel.internal.shared.DisplayHelper
    
    properties (Access = private)
        WhyInvalidMessage = '';
    end
    
    methods 
        function obj = DisplayHelperInvalid( name, classname, msg )
            % Construct a helper for displaying invalid arrays
            
            % Setup base-class
            underlyingClassName = ''; % Not used
            fullSize = [1 1];
            issparse = false;
            obj@parallel.internal.shared.DisplayHelper( ...
                name, classname, underlyingClassName, fullSize, issparse);
            
            obj.IsTruncated         = false;
            
            % Setup local properties
            obj.WhyInvalidMessage   = msg;
        end
        
        function doDisp( obj )
            doDisplayOther( obj );
        end
        
        function doDisplay( obj )
            noPageRange    = '';
            noTruncMessage = '';
            obj.nameLine( 'display', noPageRange, noTruncMessage );
            doDisplayOther( obj );
        end
    end
    
    methods ( Access = private )
        function doDisplayOther( obj )
            fprintf( 1, '    %s\n%s', obj.WhyInvalidMessage, obj.separator() );
        end
    end

    methods ( Access = protected )
        function res = formatEndTruncationMsg( ~ )
        % "other" arrays are never truncated
            res = '';
        end
    end
end
