comparison m-toolbox/classes/@plist/display.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % DISPLAY display plist object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY display plist object.
5 %
6 % <a href="matlab:utils.helper.displayMethodInfo('plist', 'display')">Parameters Description</a>
7 %
8 % VERSION: $Id: display.m,v 1.25 2011/04/08 08:56:21 hewitson Exp $
9 %
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 function varargout = display(varargin)
13
14 %%% Check if this is a call for parameters
15 if utils.helper.isinfocall(varargin{:})
16 varargout{1} = getInfo(varargin{3});
17 return
18 end
19
20 objs = utils.helper.collect_objects(varargin(:), 'plist');
21
22 txt = {};
23
24 % Print emtpy object
25 if isempty(objs)
26 hdr = sprintf('------ %s -------', class(objs));
27 ftr(1:length(hdr)) = '-';
28 txt = [txt; {hdr}];
29 txt = [txt; sprintf('empty-object [%d,%d]',size(objs))];
30 txt = [txt; {ftr}];
31 end
32
33 for ii=1:numel(objs)
34 pl = objs(ii);
35 n = length(pl.params);
36
37 banner_start = sprintf('----------- plist %02d -----------', ii);
38 txt{end+1} = banner_start;
39
40 txt{end+1} = sprintf('n params: %d', n);
41 params = pl.params;
42 if n>0
43 txt{end+1} = display(params);
44 end
45
46 txt = single_cell(txt);
47 txt{end+1} = sprintf('description: %s', pl.description);
48 txt{end+1} = sprintf('UUID: %s', pl.UUID);
49
50 banner_end(1:length(banner_start)) = '-';
51 txt{end+1} = banner_end;
52
53 end
54
55 if nargout == 0
56 for ii=1:length(txt)
57 disp(sprintf(strrep(txt{ii}, '\', '\\')));
58 end
59 else
60 varargout{1} = txt;
61 end
62
63 end
64
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 % Local Functions %
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68
69 function new_txt = single_cell(txt_field)
70
71 new_txt = {};
72 for ii=1:length(txt_field)
73 if iscell(txt_field{ii})
74 hh = single_cell(txt_field{ii});
75 new_txt(end+1:end+length(hh)) = hh(1:end);
76 else
77 new_txt{end+1} = txt_field{ii};
78 end
79 end
80 end
81
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 %
84 % FUNCTION: getInfo
85 %
86 % DESCRIPTION: Get Info Object
87 %
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89
90 function ii = getInfo(varargin)
91 if nargin == 1 && strcmpi(varargin{1}, 'None')
92 sets = {};
93 pl = [];
94 else
95 sets = {'Default'};
96 pl = getDefaultPlist;
97 end
98 % Build info object
99 ii = minfo(mfilename, 'plist', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.25 2011/04/08 08:56:21 hewitson Exp $', sets, pl);
100 ii.setModifier(false);
101 ii.setArgsmin(1);
102 ii.setOutmin(0);
103 end
104
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 %
107 % FUNCTION: getDefaultPlist
108 %
109 % DESCRIPTION: Get Default Plist
110 %
111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
112
113 function plo = getDefaultPlist()
114 plo = plist();
115 end
116