Mercurial > hg > ltpda
view m-toolbox/classes/@ltpda_obj/isprop.m @ 24:056f8e1e995e database-connection-manager
Properly record history in fromRepository constructors
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% ISPROP tests if the given field is one of the object properties. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: ISPROP tests if the given field is one of the object properties. % % CALL: obj.isprop('field'); % isprop(obj, 'field'); % % INPUTS: obj - Input objects % field - Property name of the object % % <a href="matlab:utils.helper.displayMethodInfo('ltpda_obj', 'isprop')">Parameters Description</a> % % VERSION: $Id: isprop.m,v 1.13 2011/04/08 08:56:37 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = isprop(varargin) callerIsMethod = utils.helper.callerIsMethod; %%% Check if this is a call for parameters if utils.helper.isinfocall(varargin{:}) varargout{1} = getInfo(varargin{3}); return end if callerIsMethod objs = [varargin{1:end-1}]; field = varargin{end}; else %%% Collect input variable names in_names = cell(size(varargin)); for ii = 1:nargin,in_names{ii} = inputname(ii);end %%% Collect all objects [objs, invars, rest] = utils.helper.collect_objects(varargin(:), '', in_names); %%% If we eliminated the objects and plists then is the rest the property name if length(rest) == 1 field = rest{1}; else error('### Please specify [only one] field-name.') end end res = zeros(size(objs)); if any(strcmp(field, properties(objs))) res = ones(size(objs)); else zeros(size(objs)); end %%% prepare output varargout{1} = res; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Local Functions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getInfo % % DESCRIPTION: Get Info Object % % HISTORY: 11-07-07 M Hewitson % Creation. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ii = getInfo(varargin) if nargin == 1 && strcmpi(varargin{1}, 'None') sets = {}; pl = []; else sets = {'Default'}; pl = getDefaultPlist; end % Build info object ii = minfo(mfilename, 'ltpda_obj', 'ltpda', utils.const.categories.internal, '$Id: isprop.m,v 1.13 2011/04/08 08:56:37 hewitson Exp $', sets, pl); ii.setModifier(false); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getDefaultPlist % % DESCRIPTION: Get Default Plist % % HISTORY: 11-07-07 M Hewitson % Creation. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function plout = getDefaultPlist() persistent pl; if exist('pl', 'var')==0 || isempty(pl) pl = buildplist(); end plout = pl; end function pl = buildplist() pl = plist.EMPTY_PLIST; end