view m-toolbox/classes/@paramValue/setSelection.m @ 3:960fe1aa1c10 database-connection-manager

Add LTPDADatabaseConnectionManager implementation. Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% SETSELECTION Sets the property 'selection'.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: Set the property 'selection'.
%
% CALL:        obj = obj.setSelection(SELECTION);
%              obj = setSelection(obj, SELECTION);
%
% INPUTS:      obj       - single paramValue object
%              SELECTION - one of the following values
%                          paramValue.OPTIONAL
%                          paramValue.SINGLE
%                          paramValue.MULTI
%
% REMARK:      This method checks if the index is in range of the options
%
% VERSION:     $Id: setSelection.m,v 1.1 2009/06/17 15:01:53 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = setSelection(varargin)

  %%% Check number in inputs
  if nargin ~= 2
    error('### This method accepts only two inputs. The first one must be the object and the second one an integer.');
  end
  
  obj = varargin{1};
  selection = varargin{2};
  
  %%% Check the correctness of the inputs
  if ~isa(obj, 'paramValue') || numel(obj) ~= 1
    error('### The first input must be a single paramValue object.');
  end
  if ~isnumeric(selection)
    error('### Please specify a integer for the value index.');
  end

  obj = copy(obj, nargout);
  
  obj.selection = selection;

  %%% Prepare output
  varargout{1} = obj;

end