diff m-toolbox/classes/+utils/@helper/ltpda_userclasses.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@helper/ltpda_userclasses.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,73 @@
+% LTPDA_USERCLASSES lists all the LTPDA user object types.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: LTPDA_USERCLASSES lists all the LTPDA user object types.
+%
+% CALL:        classes = ltpda_userclasses()
+%
+% INPUTS:
+%
+% OUTPUTS:     classes - a cell array with a list of recognised LTPDA user object types
+%
+% Returns a list of all ltpda classes which are derived from the ltpda_uo
+% class.
+%
+% VERSION:     $Id: ltpda_userclasses.m,v 1.6 2010/08/16 14:06:15 hewitson Exp $
+%
+% HISTORY: 14-02-08 M Hueller
+%             Creation
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function classes = ltpda_userclasses(varargin)
+
+%   prefs = getappdata(0, 'LTPDApreferences');
+%   vl = double(prefs.getDisplayPrefs.getDisplayVerboseLevel);
+%   LTPDAprefs('display', 'verboseLevel', -1);
+  classes = utils.helper.ltpda_classes;
+
+  for ii = 1:numel(classes)
+    try
+      if ~isa(eval(classes{ii}), 'ltpda_uo')
+        classes{ii} = {};
+      end
+    catch
+      classes{ii} = {};
+    end
+  end
+
+  classes = classes(~cellfun('isempty', classes));
+  classes = sort(classes);
+
+end
+
+function result = isabstract(cl)
+
+  mi = eval(['?' cl]);
+
+  hasAbstractMethod = false;
+  for kk=1:numel(mi.Methods)
+    if mi.Methods{kk}.Abstract
+      hasAbstractMethod = true;
+      break;
+    end
+  end
+
+  hasAbstractProperty = false;
+  if ~hasAbstractMethod
+    for kk=1:numel(mi.Properties)
+      if mi.Properties{kk}.Abstract
+        hasAbstractProperty = true;
+        break;
+      end
+    end
+  end
+
+  if hasAbstractProperty || hasAbstractMethod
+    result = true;
+  else
+    result = false;
+  end
+
+end
+