Mercurial > hg > ltpda
comparison m-toolbox/classes/@pest/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.4 2011/04/08 08:56:25 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 dy | |
39 appendProperty(pl, obj, 'dy'); | |
40 | |
41 % Add y | |
42 appendProperty(pl, obj, 'y'); | |
43 | |
44 % Add names | |
45 appendProperty(pl, obj, 'names'); | |
46 | |
47 % Add yunits | |
48 appendProperty(pl, obj, 'yunits'); | |
49 | |
50 % Add pdf | |
51 appendProperty(pl, obj, 'pdf'); | |
52 | |
53 % Add cov | |
54 appendProperty(pl, obj, 'cov'); | |
55 | |
56 % Add corr | |
57 appendProperty(pl, obj, 'corr'); | |
58 | |
59 % Add chi2 | |
60 appendProperty(pl, obj, 'chi2'); | |
61 | |
62 % Add dof | |
63 appendProperty(pl, obj, 'dof'); | |
64 | |
65 % Add chain | |
66 appendProperty(pl, obj, 'chain'); | |
67 | |
68 % Add models | |
69 appendProperty(pl, obj, 'models'); | |
70 | |
71 end | |
72 | |
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
74 % Local Functions % | |
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
76 | |
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
78 % | |
79 % FUNCTION: appendProperty | |
80 % | |
81 % CALL: appendProperty(pl, obj, propName) | |
82 % appendProperty(pl, obj, propName, isemptyCheck) | |
83 % | |
84 % DESCRIPTION: Get Info Object | |
85 % | |
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
87 | |
88 function appendProperty(pl, obj, propName, isemptyCheck) | |
89 | |
90 if nargin <= 3 | |
91 isemptyCheck = true; | |
92 end | |
93 | |
94 if isemptyCheck | |
95 if ~isempty(obj.(propName)) | |
96 pl.append(propName, obj.(propName)); | |
97 else | |
98 % Don't append the property to the PLIST | |
99 end | |
100 else | |
101 pl.append(propName, obj.(propName)); | |
102 end | |
103 | |
104 end | |
105 | |
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
107 % | |
108 % FUNCTION: getInfo | |
109 % | |
110 % DESCRIPTION: Get Info Object | |
111 % | |
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
113 | |
114 function ii = getInfo(varargin) | |
115 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
116 sets = {}; | |
117 pl = []; | |
118 else | |
119 sets = {'Default'}; | |
120 pl = getDefaultPlist; | |
121 end | |
122 % Build info object | |
123 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.internal, '$Id: generateConstructorPlist.m,v 1.4 2011/04/08 08:56:25 hewitson Exp $', sets, pl); | |
124 end | |
125 | |
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
127 % | |
128 % FUNCTION: getDefaultPlist | |
129 % | |
130 % DESCRIPTION: Get Default Plist | |
131 % | |
132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
133 | |
134 function plout = getDefaultPlist() | |
135 persistent pl; | |
136 if exist('pl', 'var')==0 || isempty(pl) | |
137 pl = buildplist(); | |
138 end | |
139 plout = pl; | |
140 end | |
141 | |
142 function plo = buildplist() | |
143 plo = plist.EMPTY_PLIST; | |
144 end | |
145 |