comparison m-toolbox/classes/@ltpda_uoh/requirements.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 % REQUIREMENTS Returns a list of LTPDA extension requirements for a given object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: REQUIREMENTS Returns a list of LTPDA extension requirements for a given object.
5 %
6 % CALL: list = requirements(objs)
7 %
8 % For multiple objects, the list will be the unique set of extension
9 % modules needed to build all the input objects.
10 %
11 % <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'requirements')">Parameters Description</a>
12 %
13 % VERSION: $Id: requirements.m,v 1.2 2011/04/08 08:56:30 hewitson Exp $
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17 function varargout = requirements(varargin)
18
19 %%% Check if this is a call for parameters
20 if utils.helper.isinfocall(varargin{:})
21 varargout{1} = getInfo(varargin{3});
22 return
23 end
24
25 import utils.const.*
26 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
27
28 %%% Collect all objects with the class of the first object.
29 objs = utils.helper.collect_objects(varargin(:), '');
30
31 % recursively build a list of modules for all input objects
32 requirements = {};
33 for ii = 1:numel(objs);
34 list = getRequirements(objs(ii).hist);
35 requirements = [requirements list];
36 end
37
38 % make unique
39 requirements = unique(requirements);
40
41 if nargout == 0
42 fprintf('Requirements:\n');
43 for ll=1:numel(requirements)
44 fprintf(' %s\n', requirements{ll});
45 end
46 else
47 varargout{1} = requirements;
48 end
49 end
50
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 % Local Functions %
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54
55 function list = getRequirements(h)
56
57 list = {h.methodInfo.mpackage};
58
59 for kk=1:numel(h.inhists)
60 list = [list getRequirements(h.inhists(kk))];
61 end
62
63 end
64
65
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %
68 % FUNCTION: getInfo
69 %
70 % DESCRIPTION: Get Info Object
71 %
72 % HISTORY: 10-12-2008 Diepholz
73 % Creation.
74 %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 function ii = getInfo(varargin)
77 if nargin == 1 && strcmpi(varargin{1}, 'None')
78 sets = {};
79 pl = [];
80 else
81 sets = {'Default'};
82 pl = getDefaultPlist;
83 end
84 % Build info object
85 ii = minfo(mfilename, 'ltpda_uoh', 'ltpda', utils.const.categories.helper, '$Id: requirements.m,v 1.2 2011/04/08 08:56:30 hewitson Exp $', sets, pl);
86 ii.setModifier(false);
87 end
88
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 %
91 % FUNCTION: getDefaultPlist
92 %
93 % DESCRIPTION: Get Default Plist
94 %
95 % HISTORY: 10-12-2008 Diepholz
96 % Creation.
97 %
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 function plout = getDefaultPlist()
100 persistent pl;
101 if exist('pl', 'var')==0 || isempty(pl)
102 pl = buildplist();
103 end
104 plout = pl;
105 end
106
107 function pl = buildplist()
108 pl = plist.EMPTY_PLIST;
109 end
110