comparison m-toolbox/classes/@ao/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 implement terminal display for analysis object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY implement terminal display for analysis object.
5 %
6 % CALL: txt = display(ao)
7 % ao % without a semicolon
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'display')">Parameters Description</a>
10 %
11 % VERSION: $Id: display.m,v 1.54 2011/07/05 06:33:32 mauro Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = display(varargin)
16
17 % Check if this is a call for parameters
18 if utils.helper.isinfocall(varargin{:})
19 varargout{1} = getInfo(varargin{3});
20 return
21 end
22
23 import utils.const.*
24 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
25
26 % Collect input variable names
27 in_names = cell(size(varargin));
28 for ii = 1:nargin,in_names{ii} = inputname(ii);end
29
30 % Collect all AOs
31 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
32
33 % Loop over AOs
34 txt = {};
35
36 % Print emtpy object
37 if isempty(as)
38 hdr = sprintf('------ %s -------', class(as));
39 ftr(1:length(hdr)) = '-';
40 txt = [txt; {hdr}];
41 txt = [txt; sprintf('empty-object [%d,%d]',size(as))];
42 txt = [txt; {ftr}];
43 end
44
45 for jj = 1:numel(as)
46 banner_start = sprintf('----------- ao %02d: %s -----------', jj, ao_invars{jj});
47
48 txt{end+1} = banner_start;
49 txt{end+1} = ' ';
50 if isempty(as(jj).name)
51 txt{end+1} = ' name: ''''';
52 else
53 txt{end+1} = sprintf(' name: %s', as(jj).name);
54 end
55 if isempty(as(jj).data)
56 txt{end+1} = sprintf(' data: None');
57 else
58 dtxt = sprintf(' data:');
59 if isa(as(jj).data, 'data3D')
60 % do nothing
61 else
62 mi = min(5, numel(as(jj).data.y));
63 if ~isa(as(jj).data, 'cdata')
64 for k=1:mi
65 dtxt = [dtxt sprintf(' (%s,%s)', mat2str(as(jj).data.getX(k)), mat2str(as(jj).data.y(k)))];
66 end
67 if mi < length(as(jj).data.y)
68 dtxt = [dtxt ' ...'];
69 end
70 else
71 mi = min(10, numel(as(jj).data.y));
72 for k=1:mi
73 dtxt = [dtxt sprintf(' %s', mat2str(as(jj).data.getY(k)))];
74 end
75 if mi < numel(as(jj).y)
76 dtxt = [dtxt ' ...'];
77 end
78 end
79 end
80 txt{end+1} = dtxt;
81
82 % Add some data info
83 w = display(as(jj).data);
84 for k=1:numel(w)
85 txt{end+1} = sprintf(' %s', w{k});
86 end
87 end
88 if isempty(as(jj).hist)
89 txt{end+1} = sprintf(' hist: None');
90 else
91 info = as(jj).hist.methodInfo;
92 txt{end+1} = sprintf(' hist: %s / %s / %s', info.mclass, info.mname, info.mversion);
93 end
94 txt{end+1} = sprintf('description: %s', char(as(jj).description));
95 txt{end+1} = sprintf(' UUID: %s', as(jj).UUID);
96
97 banner_end(1:length(banner_start)) = '-';
98 txt{end+1} = banner_end;
99
100 txt{end+1} = ' ';
101 txt{end+1} = ' ';
102 end
103
104 if nargout == 0
105 for ii=1:length(txt)
106 disp(txt{ii});
107 end
108 else
109 varargout{1} = txt;
110 end
111 end
112
113 %--------------------------------------------------------------------------
114 % Get Info Object
115 %--------------------------------------------------------------------------
116 function ii = getInfo(varargin)
117 if nargin == 1 && strcmpi(varargin{1}, 'None')
118 sets = {};
119 pl = [];
120 else
121 sets = {'Default'};
122 pl = getDefaultPlist;
123 end
124 % Build info object
125 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.54 2011/07/05 06:33:32 mauro Exp $', sets, pl);
126 ii.setModifier(false);
127 ii.setOutmin(0);
128 end
129
130 %--------------------------------------------------------------------------
131 % Get Default Plist
132 %--------------------------------------------------------------------------
133
134 function plout = getDefaultPlist()
135 persistent pl;
136 if exist('pl', 'var')==0 || isempty(pl)
137 pl = buildplist();
138 end
139 plout = pl;
140 end
141
142 function pl = buildplist()
143 pl = plist.EMPTY_PLIST;
144 end
145
146