comparison m-toolbox/classes/@smodel/clearAliases.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 % CLEARALIASES Clear the aliases.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CLEARALIASES Clear the aliases.
5 % This means that the properties 'aliasNames' and
6 % 'aliasValues' are set to an empty cell.
7 %
8 % CALL: obj = obj.clearAliases();
9 %
10 % INPUTS: obj - a ltpda smodel object.
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('smodel', 'clearAliases')">Parameters Description</a>
13 %
14 % VERSION: $Id: clearAliases.m,v 1.1 2011/04/11 19:51:07 ingo Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function varargout = clearAliases(varargin)
19
20 % Check if this is a call from a class method
21 callerIsMethod = utils.helper.callerIsMethod;
22
23 if callerIsMethod
24 sm = varargin{1}; % smodel-object(s)
25
26 else
27 % Check if this is a call for parameters
28 if utils.helper.isinfocall(varargin{:})
29 varargout{1} = getInfo(varargin{3});
30 return
31 end
32
33 import utils.const.*
34 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
35
36 % Collect input variable names
37 in_names = cell(size(varargin));
38 for ii = 1:nargin,in_names{ii} = inputname(ii);end
39
40 % Collect all smodel objects
41 [sm, sm_invars, rest] = utils.helper.collect_objects(varargin(:), 'smodel', in_names);
42 end
43
44 % Decide on a deep copy or a modify
45 sm = copy(sm, nargout);
46
47 % Get the deafult values for the properties
48 dNames = utils.helper.getDefaultValue(sm, 'aliasNames');
49 dValues = utils.helper.getDefaultValue(sm, 'aliasValues');
50
51 % Loop over smodel objects
52 for oo=1:numel(sm)
53
54 % Set default values
55 sm(oo).aliasNames = dNames;
56 sm(oo).aliasValues = dValues;
57
58 if ~callerIsMethod
59 sm(oo).addHistory(getInfo('None'), getDefaultPlist(), sm_invars(oo), sm(oo).hist);
60 end
61 end
62
63 % Set output
64 varargout = utils.helper.setoutputs(nargout, sm);
65 end
66
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %
69 % FUNCTION: getInfo
70 %
71 % DESCRIPTION: Get Info Object
72 %
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74
75 function ii = getInfo(varargin)
76 if nargin == 1 && strcmpi(varargin{1}, 'None')
77 sets = {};
78 pl = [];
79 else
80 sets = {'Default'};
81 pl = getDefaultPlist;
82 end
83 % Build info object
84 ii = minfo(mfilename, mfilename('class'), 'ltpda', utils.const.categories.helper, '$Id: clearAliases.m,v 1.1 2011/04/11 19:51:07 ingo Exp $', sets, pl);
85 end
86
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 %
89 % FUNCTION: getDefaultPlist
90 %
91 % DESCRIPTION: Get Default Plist
92 %
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94
95 function plout = getDefaultPlist()
96 persistent pl;
97 if exist('pl', 'var')==0 || isempty(pl)
98 pl = buildplist();
99 end
100 plout = pl;
101 end
102
103 function pl = buildplist()
104 pl = plist();
105 end
106