view m-toolbox/classes/@stattest/display.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% DISPLAY overloads display functionality for stattest objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DISPLAY overloads display functionality for stattest objects.
%
% CALL:        txt    = display(stattest)
%
% INPUT:       stattest - ltpda statistical test object
%
% OUTPUT:      txt    - cell array with strings to display the model object
%
% <a href="matlab:utils.helper.displayMethodInfo('stattest', 'display')">Parameters Description</a>
%
% VERSION:     $Id: display.m,v 1.3 2011/04/08 08:56:38 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = display(varargin)
  
  %%% Check if this is a call for parameters
  if utils.helper.isinfocall(varargin{:})
    varargout{1} = getInfo(varargin{3});
    return
  end
  
  objs = utils.helper.collect_objects(varargin(:), 'stattest');
  
  txt = {};
  
  % Print emtpy object
  if isempty(objs)
    hdr = sprintf('------ %s -------', class(objs));
    ftr(1:length(hdr)) = '-';
    txt = [txt; {hdr}];
    txt = [txt; sprintf('empty-object [%d,%d]',size(objs))];
    txt = [txt; {ftr}];
  end
  
  for ii=1:numel(objs)
    obj = objs(ii);
    banner = sprintf('---- statistical test %d ----', ii);
    txt{end+1} = banner;
    
    % get key and value
    name  = obj.name;
    
    % display name
    txt{end+1} = ['       name: ' name];
    
    % display data
    pstr = '       data: ';
    N = numel(obj.data);
    for kk=1:N
      d = obj.data{kk};
      if isa(d, 'ao')
        pstr = [pstr  sprintf('%s [%s/%s]', d.name, class(d), class(d.data))];
      else
        pstr = [pstr  sprintf('%s [%s]', d.name, class(d))];
      end
      if kk< N
        pstr = [pstr ', '];
      end
    end
    txt{end+1} = pstr;
    
    
    % display result
    txt{end+1} = ['     result: ' num2str(obj.result)];
    % display pvalue
    txt{end+1} = ['     pvalue: ' num2str(obj.pvalue)];
    
    % display description
    txt{end+1} = sprintf('description: %s', objs(ii).description);
    
    % display UUID
    txt{end+1} = sprintf('       UUID: %s', objs(ii).UUID);
    
    banner_end(1:length(banner)) = '-';
    txt{end+1} = banner_end;
  end
    
  if nargout == 0
    for ii=1:length(txt)
      disp(txt{ii});
    end
  else
    varargout{1} = txt;
  end
  
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                               Local Functions                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    getInfo
%
% DESCRIPTION: Get Info Object
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function ii = getInfo(varargin)
  if nargin == 1 && strcmpi(varargin{1}, 'None')
    sets = {};
    pl   = [];
  else
    sets = {'Default'};
    pl   = getDefaultPlist;
  end
  % Build info object
  ii = minfo(mfilename, 'smodel', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.3 2011/04/08 08:56:38 hewitson Exp $', sets, pl);
  ii.setModifier(false);
  ii.setOutmin(0);
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    getDefaultPlist
%
% DESCRIPTION: Get Default Plist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function plout = getDefaultPlist()
  persistent pl;  
  if exist('pl', 'var')==0 || isempty(pl)
    pl = buildplist();
  end
  plout = pl;  
end

function pl = buildplist()
  pl = plist.EMPTY_PLIST;
end