STRING writes a command string that can be used to recreate the input provenance object. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: STRING writes a command string that can be used to recreate the input provenance object. CALL: cmd = string(obj) INPUT: obj - provenance object OUTPUT: cmd - command string to create the input object VERSION: $Id: string.m,v 1.1 2008/02/15 17:38:59 ingo Exp $ HISTORY: 15-02-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function cmd = string(objs, varargin) 0002 % STRING writes a command string that can be used to recreate the input provenance object. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: STRING writes a command string that can be used to recreate the 0007 % input provenance object. 0008 % 0009 % CALL: cmd = string(obj) 0010 % 0011 % INPUT: obj - provenance object 0012 % 0013 % OUTPUT: cmd - command string to create the input object 0014 % 0015 % VERSION: $Id: string.m,v 1.1 2008/02/15 17:38:59 ingo Exp $ 0016 % 0017 % HISTORY: 15-02-2008 Diepholz 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 VERSION = '$Id: string.m,v 1.1 2008/02/15 17:38:59 ingo Exp $'; 0023 CATEGORY = 'Output'; 0024 0025 % Check if this is a call for parameters 0026 if nargin == 2 0027 if isa(objs, 'provenance') && ischar(varargin{1}) 0028 in = char(varargin{1}); 0029 if strcmp(in, 'Params') 0030 cmd = plist; 0031 return 0032 elseif strcmp(in, 'Version') 0033 cmd = VERSION; 0034 return 0035 elseif strcmp(in, 'Category') 0036 cmd = CATEGORY; 0037 return 0038 end 0039 end 0040 end 0041 0042 %%% Wrap the command only in bracket if the there are more than one object 0043 if length(objs) > 1 0044 cmd = '['; 0045 else 0046 cmd = ''; 0047 end 0048 0049 for j=1:length(objs) 0050 obj = objs(j); 0051 creator = obj.creator; 0052 creator = strcat('Recreated from: ', creator); 0053 0054 cmd = [cmd 'provenance(''' creator ''') ']; 0055 end 0056 0057 if length(objs) > 1 0058 cmd = [cmd ']']; 0059 end 0060 0061 % END