Mercurial > hg > ltpda
comparison m-toolbox/classes/@collection/identifyInsideObjs.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 % identifyInsideObjs Static method which identify the inside objects and configuration PLISTs. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: identifyInsideObjs Static method which identify the inside | |
5 % objects and configuration PLISTs. The input must be a | |
6 % cell-array. | |
7 % | |
8 % CALL: [objs, plConfig] = identifyInsideObjs(objsIn) | |
9 % | |
10 % INPUT: objsIn: Cell-array, for example varargin{:} | |
11 % | |
12 % OUTPUTS: objs: Objects which should go into the collection | |
13 % plConfig: Configuration PLIST. | |
14 % | |
15 % VERSION: $Id: identifyInsideObjs.m,v 1.2 2010/06/24 14:19:33 ingo Exp $ | |
16 % | |
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
18 function [objs, plConfig] = identifyInsideObjs(objsIn) | |
19 | |
20 plConfig = plist(); | |
21 objs = {}; | |
22 | |
23 % Make sure that the objsIn is a cell-array | |
24 if ~iscell(objsIn) | |
25 objsIn = num2cell(objsIn); | |
26 end | |
27 | |
28 % Loop over all inputs | |
29 for oo = 1:numel(objsIn) | |
30 | |
31 if isa(objsIn{oo}, 'plist') | |
32 pls = objsIn{oo}; | |
33 % PLISTS with the key 'ignore' and the value true are NO configuration | |
34 % PLISTS | |
35 for ii = 1:numel(pls) | |
36 if shouldIgnore(pls(ii)) | |
37 %%% This is not a configuration PLIST. Put it to the inside objects. | |
38 objs = [objs, {pls(ii)}]; | |
39 else | |
40 %%% This is a configuration PLIST. | |
41 objsInPlist = pls(ii).find('objs'); | |
42 if ~isempty(objsInPlist) | |
43 % Found objects for the collection inside the PLIST. Add this | |
44 % objects to the collection objects. | |
45 if iscell(objsInPlist) | |
46 objs = [objs, reshape(objsInPlist, 1, [])]; | |
47 else | |
48 objs = [objs, num2cell(reshape(objsInPlist, 1, []))]; | |
49 end | |
50 end | |
51 plConfig = combine(pls(ii), plConfig); | |
52 end | |
53 end | |
54 | |
55 else | |
56 objs = [objs, num2cell(reshape(objsIn{oo}, 1, []))]; | |
57 end | |
58 | |
59 end % for | |
60 | |
61 % Remove the key 'objs' from the configuration PLIST | |
62 if plConfig.isparam('objs') | |
63 plConfig.remove('objs'); | |
64 end | |
65 | |
66 end | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 |