view m-toolbox/classes/@plist/setPropertyForKey.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +0100
parents f0afece42f48
children
line wrap: on
line source

% SETPROPERTY set a property from a specified parameter to a given value.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: set a property from a specified parameter to a given value.
%              If the property name exists then replace the value otherwise
%              add this property.
%
% CALL:        obj = obj.getProperty(key, propertyName, value);
%
% INPUTS:      key:          Key for the parameter
%              propertyName: Property name of the value
%              value:        Value for the property
%
% VERSION:     $Id: setPropertyForKey.m,v 1.1 2009/07/14 16:13:20 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function obj = setPropertyForKey(obj, key, propertyName, val)

  if nargin ~= 4
    error('### This method works only with four inputs.');
  end
  
  for ii = 1:numel(obj.params)
    if strcmpi(obj.params(ii).key, key)
      obj = copy(obj, nargout);
      obj.params(ii).setProperty(propertyName, val);
      break;
    end
  end
  
end