114 static const .cell
PropClasses = {
"'critical','important','alglimit','scaling','optional','data','experimental','verbose'"};
146 elseif ischar(levels)
149 msg =
DPCM.runDPCM(DPCMobj, levels);
150 DPCM.printReport(msg, levels);
172 elseif ischar(levels)
175 [~, stats] =
DPCM.runDPCM(DPCMobj, levels);
176 DPCM.printSummary(stats, levels);
194 [msg, stats] =
DPCM.runDPCM(DPCMobj, levels);
196 if ~isempty(DPCMobj.WorkspaceVariableName)
197 link = sprintf(
" <a href='matlab:DPCM.getDPCMReport(%s, "" critical "" )'>critical properties</a> ",DPCMobj.WorkspaceVariableName);
199 link =
" critical properties ";
200 DPCM.printReport(msg, levels);
202 DPCM.print(
" red ",[
" RESULTS QUESTIONABLE: %d of %d " link
" are still at their default value.\n "],...
203 stats(1,1),stats(2,1));
220 static function printSummary(stats,levels) {
221 total = sum(stats,2);
222 total(3) = total(1)/total(2)*100;
224 col = [total(3)/100 1-total(3)/100 0];
225 DPCM.print(col,
" Total unchanged properties: %d of %d (%2.2f%%%%)\n ",total);
226 for lidx = 1:length(levels)
227 col = [stats(3,lidx)/100 1-stats(3,lidx)/100 0];
229 DPCM.print(col, " Unchanged "" %s "" : %d of %d (%2.2f%%%%)\n ",levels[lidx],stats(:,lvidx));
239 static function printReport(msg,levels) {
240 for idx = 1:length(levels)
241 m = msg.(levels[idx]);
243 DPCM.print([.5 .5 0]," Messages for property class %s:\n ",levels[idx]);
244 fprintf(" %s\n ",m[:]);
257 if ~isempty(which(
" cprintf "))
260 fprintf(2,varargin[2:end]);
270 static function [msg , pstats ] = runDPCM(DPCMobj,levels) {
274 for lidx=1:length(levels)
275 counts.(levels[lidx]) = 0;
276 messages.(levels[lidx]) = [];
281 if isfield(DPCMobj," Name ") || isprop(DPCMobj," Name ")
284 tmp = metaclass(DPCMobj);
294 c = cell2mat([struct2cell(notchanged) struct2cell(counts)])^
t;
295 c(3,:) = round(10000 * c(1,:) ./ c(2,:))/100;
296 c(3,isnan(c(3,:))) = 0;
299 function recurCheck(DPCMobj, done, lvl)
300 mc = metaclass(DPCMobj);
301 done(DPCMobj.ID) = true;
304 objlink = editLink(mc.Name);
307 pc = DPCMobj.PropertiesChanged;
308 for pidx = 1:length(mc.Properties)
309 p = mc.Properties[pidx];
310 if strcmp(p.GetAccess," public ") && ~p.Constant && ~p.Transient && strcmp(p.SetAccess," public ")
312 key = [p.DefiningClass.Name " . " p.Name];
313 if pc.containsKey(key)
316 if any(strcmp(p.Level,levels))
317 counts.(p.Level) = counts.(p.Level) + 1;
319 notchanged.(p.Level) = notchanged.(p.Level) + 1;
320 if ~any(strcmp(p.Level," data "))
321 hlp = messages.(p.Level);
323 hlp[end+1] = sprintf(" %s is still unchanged!\nProperty brief: %s\nPropclass tag description:\n%s\n ",...
324 [lvl " [ " objlink " ] -> " p.Name],p.Short,p.Text);
326 messages.(p.Level) = hlp;
330 elseif ~p.SetObservable && ~pc.containsKey([p.DefiningClass.Name " . " p.Name])
334 pobj = DPCMobj.(p.Name);
336 if isa(pobj, "
DPCMObject ") && isempty(done(pobj.ID))
337 recurCheck(pobj, done, [lvl " [ " objlink " ] -> " p.Name]);
343 function
l = editLink(classname)
344 dotpos = strfind(classname," . ");
346 lname = classname(dotpos(end)+1:end);
350 l = sprintf(" <a href='matlab:edit %s'>%s</a> ",classname,lname);
static function getDPCMReport(DPCMobj, levels)
Prints a detailed report about the properties at each level which have not been changed from their de...
static const .char PropClassesLink
Change this value to a more expressive one, i.e. a link to your software documentation which includes...
DPCMObject: Base object for any class participating in the DPCM system.
DPCM: Default property change monitoring for MatLab class properties.
A variable number of input arguments.
static function getDPCMSummary(DPCMobj, levels)
Prints a summary about the properties of different levels which have not been changed from their defa...
A basic dictionary of key/value pairs for small to medium amounts of data.
static const .cell PropClasses
The known property classes.
function count = cprintf(style, format, varargin)
CPRINTF displays styled formatted text in the Command Window.
static function criticalsCheck(DPCMobj)
This is a shorthand method that runs the DPCM but only for critical properties.