comparison m-toolbox/classes/@collection/char.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 % CHAR convert a collection object into a string.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CHAR convert a collection object into a string.
5 %
6 % CALL: string = char(collection)
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('collection', 'char')">Parameters Description</a>
9 %
10 % VERSION: $Id: char.m,v 1.6 2011/04/08 08:56:22 hewitson Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function varargout = char(varargin)
15
16 %%% Check if this is a call for parameters
17 if utils.helper.isinfocall(varargin{:})
18 varargout{1} = getInfo(varargin{3});
19 return
20 end
21
22 objs = utils.helper.collect_objects(varargin(:), 'collection');
23
24 pstr = '';
25
26 for oo = 1:numel(objs)
27 pstr = [pstr, 'collection('];
28 for ii = 1:numel(objs(oo).objs)
29 pstr = [pstr, char(objs(oo).objs{ii}), ', '];
30 end
31 if (pstr(end-1) == ','), pstr = pstr(1:end-2); end;
32 pstr = [pstr, '), '];
33 end
34
35 varargout{1} = pstr(1:end-2);
36 end
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 % Local Functions %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 %
44 % FUNCTION: getInfo
45 %
46 % DESCRIPTION: Get Info Object
47 %
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49
50 function ii = getInfo(varargin)
51 if nargin == 1 && strcmpi(varargin{1}, 'None')
52 sets = {};
53 pl = [];
54 else
55 sets = {'Default'};
56 pl = getDefaultPlist;
57 end
58 % Build info object
59 ii = minfo(mfilename, 'collection', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.6 2011/04/08 08:56:22 hewitson Exp $', sets, pl);
60 ii.setModifier(false);
61 end
62
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 %
65 % FUNCTION: getDefaultPlist
66 %
67 % DESCRIPTION: Get Default Plist
68 %
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70
71 function plout = getDefaultPlist()
72 persistent pl;
73 if exist('pl', 'var')==0 || isempty(pl)
74 pl = buildplist();
75 end
76 plout = pl;
77 end
78
79 function pl = buildplist()
80 pl = plist.EMPTY_PLIST;
81 end
82