SETTIMEZONE Set the property 'timezone'. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Set the property 'timezone'. CALL: obj = obj.setTimezone('new timezone'); obj = obj.setTimezone(plist('timezone', 'new timezone')); obj = setTimezone(obj, 'new timezone'); INPUTS: obj - can be a vector, matrix, list, or a mix of them. pl - to set the timezone with a plist specify only one plist with only one key-word 'timezone'. M-FILE INFO: Get information about this methods by calling >> timespan.getInfo('setTimezone') Get information about a specified set-plist by calling: >> timespan.getInfo('setTimezone', 'None') VERSION: $Id: setTimezone.m,v 1.2 2008/09/04 15:29:31 ingo Exp $ HISTORY: 27-05-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % SETTIMEZONE Set the property 'timezone'. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: Set the property 'timezone'. 0005 % 0006 % CALL: obj = obj.setTimezone('new timezone'); 0007 % obj = obj.setTimezone(plist('timezone', 'new timezone')); 0008 % obj = setTimezone(obj, 'new timezone'); 0009 % 0010 % INPUTS: obj - can be a vector, matrix, list, or a mix of them. 0011 % pl - to set the timezone with a plist specify only one plist with 0012 % only one key-word 'timezone'. 0013 % 0014 % M-FILE INFO: Get information about this methods by calling 0015 % >> timespan.getInfo('setTimezone') 0016 % 0017 % Get information about a specified set-plist by calling: 0018 % >> timespan.getInfo('setTimezone', 'None') 0019 % 0020 % VERSION: $Id: setTimezone.m,v 1.2 2008/09/04 15:29:31 ingo Exp $ 0021 % 0022 % HISTORY: 27-05-2008 Diepholz 0023 % Creation 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 function varargout = setTimezone(varargin) 0028 0029 %%% Check if this is a call for parameters 0030 if utils.helper.isinfocall(varargin{:}) 0031 varargout{1} = getInfo(varargin{3}); 0032 return 0033 end 0034 0035 %%% Internal call: Only one object + don't look for a plist 0036 if strcmp(varargin{end}, 'internal') 0037 0038 %%% decide whether we modify the timespan-object, or create a new one. 0039 varargin{1} = copy(varargin{1}, nargout); 0040 0041 varargin{1}.startT.setTimezone(varargin{2}); 0042 varargin{1}.endT.setTimezone(varargin{2}); 0043 varargin{1}.timezone = varargin{1}.startT.timezone; 0044 varargout{1} = varargin{1}; 0045 return 0046 end 0047 0048 %%% Normal call: 0049 [objs, invars, rest] = utils.helper.collect_objects(varargin(:), 'timespan'); 0050 [pls, invars, rest] = utils.helper.collect_objects(rest(:), 'plist'); 0051 0052 timezone = rest; 0053 0054 if length(timezone) ~=1 0055 0056 if length(pls) == 1 0057 timezone = {}; 0058 if nparams(pls) == 1 && isparam(pls, 'timezone') 0059 0060 %%% If the plist contains only one parameter with the key-word 'timezone' 0061 %%% then set 'timezone' to the value in the timespan object. 0062 timezone{1} = find(pls, 'timezone'); 0063 0064 else 0065 timezone{1} = pls; 0066 end 0067 elseif length(pls) > 1 0068 error('### To set the ''timezone'' please specify only one plist') 0069 else 0070 error('### Please specify [only one] value.') 0071 end 0072 end 0073 0074 %%% Set the timezone 0075 for ii = 1:numel(objs) 0076 %%% decide whether we modify the timespan-object, or create a new one. 0077 objs(ii) = copy(objs(ii), nargout); 0078 0079 objs(ii).startT.setTimezone(timezone{1}); 0080 objs(ii).endT.setTimezone(timezone{1}); 0081 objs(ii).timezone = objs(ii).startT.timezone; 0082 objs(ii).addHistory(getInfo, plist('timezone', objs(ii).timezone), [], objs(ii).hist); 0083 end 0084 0085 %%% Prepare output 0086 varargout{1} = objs; 0087 0088 end 0089 0090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0091 % Local Functions % 0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0093 0094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0095 % 0096 % FUNCTION: getInfo 0097 % 0098 % DESCRIPTION: Get Info Object 0099 % 0100 % HISTORY: 11-07-07 M Hewitson 0101 % Creation. 0102 % 0103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0104 0105 function ii = getInfo(varargin) 0106 if nargin == 1 && strcmpi(varargin{1}, 'None') 0107 sets = {}; 0108 pl = []; 0109 else 0110 sets = {'Default'}; 0111 pl = getDefaultPlist; 0112 end 0113 % Build info object 0114 ii = minfo(mfilename, 'timespan', '', utils.const.categories.helper, '$Id: setTimezone.m,v 1.2 2008/09/04 15:29:31 ingo Exp $', sets, pl); 0115 end 0116 0117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0118 % 0119 % FUNCTION: getDefaultPlist 0120 % 0121 % DESCRIPTION: Get Default Plist 0122 % 0123 % HISTORY: 11-07-07 M Hewitson 0124 % Creation. 0125 % 0126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0127 0128 function plo = getDefaultPlist() 0129 plo = plist('timezone', ''); 0130 end 0131