Home > classes > @timespan > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function varargout = string(varargin)

DESCRIPTION ^

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

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

 CALL:        cmd = string(obj)

 INPUT:       obj - timespan object

 OUTPUT:      cmd - command string to create the input object

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

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

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

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

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