Mercurial > hg > ltpda
comparison m-toolbox/classes/@ltpda_uoh/rebuild.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 % REBUILD rebuilds the input objects using the history. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: REBUILD rebuilds the input objects using the history. | |
5 % | |
6 % CALL: out = rebuild(as) | |
7 % | |
8 % INPUTS: as - array of ltpda_uoh objects of the same kind | |
9 % | |
10 % OUTPUTS: out - array of rebuilt objects. | |
11 % | |
12 % <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'rebuild')">Parameters Description</a> | |
13 % | |
14 % VERSION: $Id: rebuild.m,v 1.14 2011/11/16 08:26:35 mauro Exp $ | |
15 % | |
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
17 | |
18 function varargout = rebuild(varargin) | |
19 | |
20 import utils.const.* | |
21 | |
22 % Check if this is a call for parameters | |
23 if utils.helper.isinfocall(varargin{:}) | |
24 varargout{1} = getInfo(varargin{3}); | |
25 return | |
26 end | |
27 | |
28 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
29 | |
30 if nargout == 0 | |
31 error('### rebuild cannot be used as a modifier. Please give an output variable.'); | |
32 end | |
33 | |
34 % Collect input variable names | |
35 in_names = cell(size(varargin)); | |
36 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
37 | |
38 % Collect all AOs and plists | |
39 [as, ao_invars, rest] = utils.helper.collect_objects(varargin(:), 'ltpda_uoh', in_names); | |
40 [pl, pl_invars, rest] = utils.helper.collect_objects(rest, 'plist', in_names); | |
41 | |
42 % Combine plists | |
43 pl = combine(pl, getDefaultPlist); | |
44 | |
45 % Go through each input AO | |
46 bs = []; | |
47 for jj = 1:numel(as) | |
48 | |
49 if isempty(as(jj).hist) | |
50 error('### Can not rebuild the object because the object have no history.'); | |
51 end | |
52 | |
53 % Rebuild the object and add to outputs | |
54 bs = [bs rebuild(as(jj).hist);]; | |
55 | |
56 end % End object loop | |
57 | |
58 % Set output | |
59 varargout = utils.helper.setoutputs(nargout, bs); | |
60 | |
61 end | |
62 | |
63 %-------------------------------------------------------------------------- | |
64 % Get Info Object | |
65 %-------------------------------------------------------------------------- | |
66 function ii = getInfo(varargin) | |
67 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
68 sets = {}; | |
69 pl = []; | |
70 else | |
71 sets = {'Default'}; | |
72 pl = getDefaultPlist; | |
73 end | |
74 % Build info object | |
75 ii = minfo(mfilename, 'ltpda_uoh', 'ltpda', utils.const.categories.constructor, '$Id: rebuild.m,v 1.14 2011/11/16 08:26:35 mauro Exp $', sets, pl); | |
76 ii.setModifier(false); | |
77 end | |
78 | |
79 %-------------------------------------------------------------------------- | |
80 % Get Default Plist | |
81 %-------------------------------------------------------------------------- | |
82 function plout = getDefaultPlist() | |
83 persistent pl; | |
84 if ~exist('pl', 'var') || isempty(pl) | |
85 pl = buildplist(); | |
86 end | |
87 plout = pl; | |
88 end | |
89 | |
90 function pl = buildplist() | |
91 pl = plist.EMPTY_PLIST; | |
92 end | |
93 |