Mercurial > hg > ltpda
comparison m-toolbox/classes/@ssm/generateConstructorPlist.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 % GENERATECONSTRUCTORPLIST generates a PLIST from the properties which can rebuild the object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: GENERATECONSTRUCTORPLIST generates a PLIST from the | |
5 % properties which can rebuild the object. | |
6 % | |
7 % CALL: pl = obj.generateConstructorPlist(); | |
8 % | |
9 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'generateConstructorPlist')">Parameters Description</a> | |
10 % | |
11 % VERSION: $Id: generateConstructorPlist.m,v 1.3 2011/04/08 08:56:22 hewitson Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 function pl = generateConstructorPlist(varargin) | |
16 | |
17 % Check if this is a call for parameters | |
18 if utils.helper.isinfocall(varargin{:}) | |
19 pl = getInfo(varargin{3}); | |
20 return | |
21 end | |
22 | |
23 obj = varargin{1}; | |
24 pl = plist(); | |
25 | |
26 % Add procinfo | |
27 appendProperty(pl, obj, 'procinfo'); | |
28 | |
29 % Add plotinfo | |
30 appendProperty(pl, obj, 'plotinfo'); | |
31 | |
32 % Add name | |
33 appendProperty(pl, obj, 'name', false); | |
34 | |
35 % Add description | |
36 appendProperty(pl, obj, 'description'); | |
37 | |
38 % Add amats | |
39 appendProperty(pl, obj, 'amats'); | |
40 | |
41 % Add bmats | |
42 appendProperty(pl, obj, 'bmats'); | |
43 | |
44 % Add cmats | |
45 appendProperty(pl, obj, 'cmats'); | |
46 | |
47 % Add dmats | |
48 appendProperty(pl, obj, 'dmats'); | |
49 | |
50 % Add timestep | |
51 appendProperty(pl, obj, 'timestep'); | |
52 | |
53 % Add params | |
54 appendProperty(pl, obj, 'params'); | |
55 | |
56 % Add statenames | |
57 appendProperty(pl, obj, 'statenames'); | |
58 | |
59 % Add inputnames | |
60 appendProperty(pl, obj, 'inputnames'); | |
61 | |
62 % Add outputnames | |
63 appendProperty(pl, obj, 'outputnames'); | |
64 | |
65 end | |
66 | |
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
68 % Local Functions % | |
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
70 | |
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
72 % | |
73 % FUNCTION: appendProperty | |
74 % | |
75 % CALL: appendProperty(pl, obj, propName) | |
76 % appendProperty(pl, obj, propName, isemptyCheck) | |
77 % | |
78 % DESCRIPTION: Get Info Object | |
79 % | |
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
81 | |
82 function appendProperty(pl, obj, propName, isemptyCheck) | |
83 | |
84 if nargin <= 3 | |
85 isemptyCheck = true; | |
86 end | |
87 | |
88 if isemptyCheck | |
89 if ~isempty(obj.(propName)) | |
90 pl.append(propName, obj.(propName)); | |
91 else | |
92 % Don't append the property to the PLIST | |
93 end | |
94 else | |
95 pl.append(propName, obj.(propName)); | |
96 end | |
97 | |
98 end | |
99 | |
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
101 % | |
102 % FUNCTION: getInfo | |
103 % | |
104 % DESCRIPTION: Get Info Object | |
105 % | |
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
107 | |
108 function ii = getInfo(varargin) | |
109 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
110 sets = {}; | |
111 pl = []; | |
112 else | |
113 sets = {'Default'}; | |
114 pl = getDefaultPlist; | |
115 end | |
116 % Build info object | |
117 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.internal, '$Id: generateConstructorPlist.m,v 1.3 2011/04/08 08:56:22 hewitson Exp $', sets, pl); | |
118 end | |
119 | |
120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
121 % | |
122 % FUNCTION: getDefaultPlist | |
123 % | |
124 % DESCRIPTION: Get Default Plist | |
125 % | |
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
127 | |
128 function plo = getDefaultPlist() | |
129 plo = plist(); | |
130 end | |
131 |