Mercurial > hg > ltpda
comparison m-toolbox/classes/@minfo/minfo.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 % MINFO a helper class for LTPDA methods. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % MINFO is a helper class for LTPDA methods. It holds minformation about the | |
5 % method. | |
6 % | |
7 % SUPERCLASSES: ltpda_nuo < ltpda_obj | |
8 % | |
9 % CONSTRUCTORS: | |
10 % | |
11 % m = minfo() - creates an empty object | |
12 % m = minfo(mname, ... - | |
13 % mclass, ... | |
14 % mpackage, ... | |
15 % mcategory, ... | |
16 % mversion, ... | |
17 % param_sets, ... | |
18 % plists, ... | |
19 % argsmin, ... | |
20 % argsmax) | |
21 % | |
22 % VERSION: $Id: minfo.m,v 1.42 2011/04/17 09:20:52 hewitson Exp $ | |
23 % | |
24 % SEE ALSO: ltpda_obj, ltpda_nuo, history | |
25 % | |
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
27 | |
28 classdef (Hidden = true) minfo < ltpda_nuo | |
29 | |
30 %------------------------------------------------ | |
31 %---------- Private read-only Properties -------- | |
32 %------------------------------------------------ | |
33 properties (SetAccess = protected) | |
34 mname = ''; % The method name | |
35 mclass = ''; % The method class | |
36 mpackage = 'ltpda'; % The package (if applicable) | |
37 mcategory = ''; % The category of the method | |
38 mversion = ''; % The cvs-version of the method | |
39 description = ''; % description of the model or method | |
40 children = []; | |
41 sets = {}; % A cell array of parameter set names | |
42 plists = []; % An array of parameter lists | |
43 argsmin = 1; % Minimum number of input arguments [0 is unbounded] | |
44 argsmax = -1; % Maximum number of input arguments [0 is unbounded] | |
45 outmin = 1; % Minimum number of output arguments | |
46 outmax = -1; % Maximum number of output arguments | |
47 modifier = true; % Can the method be used as a modifier | |
48 end | |
49 | |
50 properties (SetAccess = protected) | |
51 end | |
52 | |
53 %------------------------------------------------ | |
54 %-------- Declaration of public methods -------- | |
55 %------------------------------------------------ | |
56 methods | |
57 | |
58 %------------------------------------------------ | |
59 %-------- Property rules -------- | |
60 %------------------------------------------------ | |
61 | |
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
63 % Constructor % | |
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
65 function ii = minfo(varargin) | |
66 | |
67 switch nargin | |
68 case 0 | |
69 case 1 | |
70 | |
71 if isstruct(varargin{1}) | |
72 %%%%%%%%%% ii = minfo(structure) %%%%%%%%%% | |
73 %%%%%%%%%% necessary for readxml %%%%%%%%%% | |
74 ii = fromStruct(ii, varargin{1}); | |
75 elseif isa(varargin{1}, 'minfo') | |
76 ii = copy(varargin{1}, 1); | |
77 else | |
78 ii.mname = varargin{1}; | |
79 end | |
80 | |
81 case 2 | |
82 if isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ... | |
83 isa(varargin{2}, 'history') | |
84 %%%%%%%%%% obj = minfo(DOM node, history-objects) %%%%%%%%%% | |
85 %%%%%%%%%% necessary for reading new XML files %%%%%%%%%% | |
86 ii = fromDom(ii, varargin{1}, varargin{2}); | |
87 | |
88 else | |
89 ii.mname = varargin{1}; | |
90 ii.mclass = varargin{2}; | |
91 end | |
92 case 3 | |
93 ii.mname = varargin{1}; | |
94 ii.mclass = varargin{2}; | |
95 ii.mpackage = varargin{3}; | |
96 case 4 | |
97 ii.mname = varargin{1}; | |
98 ii.mclass = varargin{2}; | |
99 ii.mpackage = varargin{3}; | |
100 ii.mcategory = varargin{4}; | |
101 case 5 | |
102 ii.mname = varargin{1}; | |
103 ii.mclass = varargin{2}; | |
104 ii.mpackage = varargin{3}; | |
105 ii.mcategory = varargin{4}; | |
106 ii.mversion = varargin{5}; | |
107 case 6 | |
108 ii.mname = varargin{1}; | |
109 ii.mclass = varargin{2}; | |
110 ii.mpackage = varargin{3}; | |
111 ii.mcategory = varargin{4}; | |
112 ii.mversion = varargin{5}; | |
113 ii.sets = varargin{6}; | |
114 case 7 | |
115 ii.mname = varargin{1}; | |
116 ii.mclass = varargin{2}; | |
117 ii.mpackage = varargin{3}; | |
118 ii.mcategory = varargin{4}; | |
119 ii.mversion = varargin{5}; | |
120 ii.sets = varargin{6}; | |
121 % add plists until we have at least as many as set | |
122 % descriptions | |
123 pls = varargin{7}; | |
124 while numel(pls) < numel(ii.sets) | |
125 pls = [pls plist]; | |
126 end | |
127 ii.plists = pls; | |
128 % Check we have one set description per plist | |
129 if numel(ii.plists) ~= numel(ii.sets) | |
130 dummySets = ii.sets; | |
131 while numel(dummySets) < numel(ii.plists) | |
132 dummySets = [dummySets {''}]; | |
133 end | |
134 ii.sets = dummySets; | |
135 end | |
136 case 8 | |
137 ii.mname = varargin{1}; | |
138 ii.mclass = varargin{2}; | |
139 ii.mpackage = varargin{3}; | |
140 ii.mcategory = varargin{4}; | |
141 ii.mversion = varargin{5}; | |
142 ii.sets = varargin{6}; | |
143 % add plists until we have at least as many as set | |
144 % descriptions | |
145 pls = varargin{7}; | |
146 while numel(pls) < numel(ii.sets) | |
147 pls = [pls plist]; | |
148 end | |
149 ii.plists = pls; | |
150 % Check we have one set description per plist | |
151 if numel(ii.plists) ~= numel(ii.sets) | |
152 dummySets = ii.sets; | |
153 while numel(dummySets) < numel(ii.plists) | |
154 dummySets = [dummySets {''}]; | |
155 end | |
156 ii.sets = dummySets; | |
157 end | |
158 ii.argsmin = varargin{8}; | |
159 case 9 | |
160 ii.mname = varargin{1}; | |
161 ii.mclass = varargin{2}; | |
162 ii.mpackage = varargin{3}; | |
163 ii.mcategory = varargin{4}; | |
164 ii.mversion = varargin{5}; | |
165 ii.sets = varargin{6}; | |
166 % add plists until we have at least as many as set | |
167 % descriptions | |
168 pls = varargin{7}; | |
169 while numel(pls) < numel(ii.sets) | |
170 pls = [pls plist]; | |
171 end | |
172 ii.plists = pls; | |
173 % Check we have one set description per plist | |
174 if numel(ii.plists) ~= numel(ii.sets) | |
175 dummySets = ii.sets; | |
176 while numel(dummySets) < numel(ii.plists) | |
177 dummySets = [dummySets {''}]; | |
178 end | |
179 ii.sets = dummySets; | |
180 end | |
181 ii.argsmin = varargin{8}; | |
182 ii.argsmax = varargin{9}; | |
183 case 12 | |
184 % Necessary for the string-method. | |
185 ii.mname = varargin{1}; | |
186 ii.mclass = varargin{2}; | |
187 ii.mpackage = varargin{3}; | |
188 ii.mcategory = varargin{4}; | |
189 ii.mversion = varargin{5}; | |
190 ii.sets = varargin{6}; | |
191 if ~isempty(varargin{7}) | |
192 ii.plists = varargin{7}; | |
193 end | |
194 ii.argsmin = varargin{8}; | |
195 ii.argsmax = varargin{9}; | |
196 ii.outmin = varargin{10}; | |
197 ii.outmax = varargin{11}; | |
198 ii.modifier = varargin{12}; | |
199 | |
200 otherwise | |
201 error('### Unknown number of constructor arguments'); | |
202 end | |
203 | |
204 | |
205 end % End of constructor | |
206 end % End public methods | |
207 | |
208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
209 % Methods (public) % | |
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
211 | |
212 methods | |
213 varargout = char(varargin) | |
214 varargout = copy(varargin) | |
215 varargout = display(varargin) | |
216 varargout = setMversion(varargin) | |
217 varargout = setModifier(varargin) | |
218 varargout = setArgsmax(varargin) | |
219 varargout = setArgsmin(varargin) | |
220 varargout = setOutmin(varargin) | |
221 varargout = setOutmax(varargin) | |
222 varargout = setMclass(varargin) | |
223 varargout = addChildren(varargin) | |
224 end | |
225 | |
226 methods (Hidden = true) | |
227 varargout = attachToDom(varargin) | |
228 varargout = clearSets(varargin) | |
229 varargout = getEncodedString(varargin) | |
230 end | |
231 | |
232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
233 % Methods (protected) % | |
234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
235 | |
236 methods (Access = protected) | |
237 varargout = fromStruct(varargin) | |
238 varargout = fromDom(varargin) | |
239 end | |
240 | |
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
242 % Methods (private) % | |
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
244 | |
245 methods (Access = private) | |
246 end | |
247 | |
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
249 % Methods (Static, Public) % | |
250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
251 | |
252 methods (Static = true) | |
253 | |
254 function out = VEROUT() | |
255 out = '$Id: minfo.m,v 1.42 2011/04/17 09:20:52 hewitson Exp $'; | |
256 end | |
257 | |
258 function ii = getInfo(varargin) | |
259 ii = utils.helper.generic_getInfo(varargin{:}, 'minfo'); | |
260 end | |
261 | |
262 function out = SETS() | |
263 out = {'Default'}; | |
264 end | |
265 | |
266 function out = getDefaultPlist(set) | |
267 switch lower(set) | |
268 case 'default' | |
269 out = plist(); | |
270 otherwise | |
271 error('### Unknown set [%s]', set); | |
272 end | |
273 end | |
274 | |
275 function obj = initObjectWithSize(n,m) | |
276 obj = minfo.newarray([n m]); | |
277 end | |
278 | |
279 varargout = getInfoAxis(varargin); | |
280 | |
281 end | |
282 | |
283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
284 % Methods (Static, Private) % | |
285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
286 | |
287 methods (Static = true, Access = private) | |
288 end | |
289 | |
290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
291 % Methods (static, hidden) % | |
292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
293 | |
294 methods (Static = true, Hidden = true) | |
295 varargout = loadobj(varargin) | |
296 varargout = update_struct(varargin); | |
297 varargout = setFromEncodedInfo(varargin) | |
298 end | |
299 | |
300 end | |
301 |