Home > classes > @time > string.m

string

PURPOSE ^

STRING writes a command string that can be used to recreate the input time object.

SYNOPSIS ^

function varargout = string(varargin)

DESCRIPTION ^

 STRING writes a command string that can be used to recreate the input time object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: STRING writes a command string that can be used to recreate the
              input time object.

 CALL:        cmd = string(time-object);

 M-FILE INFO: Get information about this methods by calling
              >> time.getInfo('string')

              Get information about a specified set-plist by calling:
              >> time.getInfo('string', 'set')

 VERSION:     $Id: string.m,v 1.9 2008/09/04 15:29:31 ingo Exp $

 HISTORY:     07-08-2007 Diepholz
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % STRING writes a command string that can be used to recreate the input time object.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: STRING writes a command string that can be used to recreate the
0005 %              input time object.
0006 %
0007 % CALL:        cmd = string(time-object);
0008 %
0009 % M-FILE INFO: Get information about this methods by calling
0010 %              >> time.getInfo('string')
0011 %
0012 %              Get information about a specified set-plist by calling:
0013 %              >> time.getInfo('string', 'set')
0014 %
0015 % VERSION:     $Id: string.m,v 1.9 2008/09/04 15:29:31 ingo Exp $
0016 %
0017 % HISTORY:     07-08-2007 Diepholz
0018 %                 Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 function varargout = string(varargin)
0023 
0024   % Check if this is a call for parameters
0025   if utils.helper.isinfocall(varargin{:})
0026     varargout{1} = getInfo(varargin{3});
0027     return
0028   end
0029 
0030   % collect the time-objects
0031   tt = utils.helper.collect_objects(varargin(:), 'time');
0032 
0033   cmd = '';
0034   for jj=1:length(tt)
0035 
0036     pl = plist();
0037     pl.append('timeformat',      char(tt(jj).timeformat));
0038     pl.append('timezone',        char(tt(jj).timezone.getID));
0039     pl.append('utc_epoch_milli', tt(jj).utc_epoch_milli);
0040 
0041     cmd = [cmd 'time(' string(pl) ') '];
0042 
0043   end
0044 
0045   %%% Wrap the command only with brackets if the there are more than one object
0046   if numel(tt) > 1
0047     cmd = ['[' cmd(1:end-1) ']'];
0048   end
0049 
0050   % prepare output
0051   varargout{1} = cmd;
0052 
0053 end
0054 
0055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0056 %                               Local Functions                               %
0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0058 
0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0060 %
0061 % FUNCTION:    getInfo
0062 %
0063 % DESCRIPTION: Get Info Object
0064 %
0065 % HISTORY:     11-07-07 M Hewitson
0066 %                Creation.
0067 %
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 
0070 function ii = getInfo(varargin)
0071   if nargin == 1 && strcmpi(varargin{1}, 'None')
0072     sets = {};
0073     pl   = [];
0074   else
0075     sets = {'Default'};
0076     pl   = getDefaultPlist;
0077   end
0078   % Build info object
0079   ii = minfo(mfilename, 'time', '', utils.const.categories.helper, '$Id: string.m,v 1.9 2008/09/04 15:29:31 ingo Exp $', sets, pl);
0080 end
0081 
0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0083 %
0084 % FUNCTION:    getDefaultPlist
0085 %
0086 % DESCRIPTION: Get Default Plist
0087 %
0088 % HISTORY:     11-07-07 M Hewitson
0089 %                Creation.
0090 %
0091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0092 
0093 function plo = getDefaultPlist()
0094   plo = plist();
0095 end
0096

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003