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