Mercurial > hg > ltpda
view m-toolbox/classes/@pest/genericSet.m @ 8:2f5c9bd7d95d database-connection-manager
Clarify ltpda_uo.retrieve parameters handling
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% GENERICSET sets values to a pest property. % % CALL: % out = genericSet(args, paramName, in_names, callerIsMethod); % % $Id: genericSet.m,v 1.6 2011/08/16 05:16:16 hewitson Exp $ % function out = genericSet(varargin) pName = varargin{end-2}; in_names = varargin{end-1}; callerIsMethod = varargin{end}; args = varargin(1:end-3); if callerIsMethod objs = varargin{1}; values = varargin(2:end-3); else % Collect all Objects [objs, objs_invars, rest] = utils.helper.collect_objects(args(:), '', in_names); [pls, invars, values] = utils.helper.collect_objects(rest(:), 'plist'); %%% If pls contains only one plist with the single property-key then set %%% the property with a plist. if length(pls) == 1 && isa(pls, 'plist') && nparams(pls) == 1 && isparam(pls, pName) values{1} = find(pls, pName); end % Get minfo-object mi = objs.getInfo(sprintf('set%s%s', upper(pName(1)), pName(2:end))); dpl = mi.plists; % Combine input plists and default PLIST pls = combine(pls, dpl); end % callerIsMethod % Decide on a deep copy or a modify objs = copy(objs, nargout); % Loop over AOs for j=1:numel(objs) objs(j).(pName) = values(:); if ~callerIsMethod plh = pls.pset(pName, objs(j).(pName)); objs(j).addHistory(objs.getInfo(sprintf('set%s%s', upper(pName(1)), pName(2:end)), 'None'), plh, objs_invars(j), objs(j).hist); end end out = objs; end