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