HISTORY History object class constructor. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: HISTORY History object class constructor. Create a history object. SUPER CLASSES: ltpda_nuo < ltpda_obj PROPERTIES: Inherit Properties (read only) version - cvs-version string. Protected Properties (read only) methodInfo - minfo-object which is created in the called method. plistUsed - plist-object which is used in the called method. methodInvars - variable names which are used for the called method. inhists - the older history-objects proctime - creation time of the history object. Private Properties HISTORY METHODS: Defined Abstract methods: char - returns one character string which represents the object copy - copies an object display - displays an object update_struct - updates a object structure to the current tbx-version Public methods: getNodes - converts a history object to a nodes structure getNodes_plot - converts a history object to a nodes structure with max depth hist2dot - converts a history object to a 'DOT' file suitable for processing with graphviz hist2m - writes a new m-file that reproduces the analysis described in the history object. plot - plots a history object as a tree diagram. string - writes a command string that can be used to recreate the input history object. CONSTRUCTORS: h = history() h = history(proctime, minfo, plist) h = history(proctime, minfo, plist, in_names, in_hists) h = history(filename) h = history(structure) h = history(history-object) h = history('database', ...) INPUTS: minfo: Minfo-object which is created in the called method. plist: Plist-object which is used in the called method. in_hist: Older history-objects var_names: Variable names which are used for the called method. M-FILE INFO: The following call returns an minfo object that contains information about the history constructor: >> info = history.getInfo or >> info = history.getInfo('history') You can get information about class methods by calling: >> info = history.getInfo(method) e.g. >> info = history.getInfo('eq') You can also restrict the sets of parameters contained in the minfo object by calling: >> info = history.getInfo(method, set) e.g. >> info = history.getInfo('history', 'Default') VERSION: $Id: history.m,v 1.41 2008/09/08 08:30:40 hewitson Exp $ HISTORY: 19-05-2008 Diepholz Creation. SEE ALSO: ltpda_obj, ltpda_nuo, minfo, plist %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % HISTORY History object class constructor. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: HISTORY History object class constructor. 0005 % Create a history object. 0006 % 0007 % SUPER CLASSES: ltpda_nuo < ltpda_obj 0008 % 0009 % PROPERTIES: 0010 % 0011 % Inherit Properties (read only) 0012 % version - cvs-version string. 0013 % 0014 % Protected Properties (read only) 0015 % methodInfo - minfo-object which is created in the called method. 0016 % plistUsed - plist-object which is used in the called method. 0017 % methodInvars - variable names which are used for the called method. 0018 % inhists - the older history-objects 0019 % proctime - creation time of the history object. 0020 % 0021 % Private Properties 0022 % 0023 % HISTORY METHODS: 0024 % 0025 % Defined Abstract methods: 0026 % char - returns one character string which represents the object 0027 % copy - copies an object 0028 % display - displays an object 0029 % update_struct - updates a object structure to the current tbx-version 0030 % 0031 % Public methods: 0032 % getNodes - converts a history object to a nodes structure 0033 % getNodes_plot - converts a history object to a nodes structure with max depth 0034 % hist2dot - converts a history object to a 'DOT' file suitable for 0035 % processing with graphviz 0036 % hist2m - writes a new m-file that reproduces the analysis 0037 % described in the history object. 0038 % plot - plots a history object as a tree diagram. 0039 % string - writes a command string that can be used to recreate 0040 % the input history object. 0041 % 0042 % CONSTRUCTORS: 0043 % 0044 % h = history() 0045 % h = history(proctime, minfo, plist) 0046 % h = history(proctime, minfo, plist, in_names, in_hists) 0047 % 0048 % h = history(filename) 0049 % h = history(structure) 0050 % h = history(history-object) 0051 % h = history('database', ...) 0052 % 0053 % INPUTS: minfo: Minfo-object which is created in the called method. 0054 % plist: Plist-object which is used in the called method. 0055 % in_hist: Older history-objects 0056 % var_names: Variable names which are used for the called method. 0057 % 0058 % M-FILE INFO: The following call returns an minfo object that contains 0059 % information about the history constructor: 0060 % >> info = history.getInfo 0061 % or >> info = history.getInfo('history') 0062 % 0063 % You can get information about class methods by calling: 0064 % >> info = history.getInfo(method) 0065 % e.g. >> info = history.getInfo('eq') 0066 % 0067 % You can also restrict the sets of parameters contained in 0068 % the minfo object by calling: 0069 % >> info = history.getInfo(method, set) 0070 % e.g. >> info = history.getInfo('history', 'Default') 0071 % 0072 % VERSION: $Id: history.m,v 1.41 2008/09/08 08:30:40 hewitson Exp $ 0073 % 0074 % HISTORY: 19-05-2008 Diepholz 0075 % Creation. 0076 % 0077 % SEE ALSO: ltpda_obj, ltpda_nuo, minfo, plist 0078 % 0079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0080 0081 classdef (Sealed = true) history < ltpda_nuo 0082 0083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0084 % Property definition % 0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0086 0087 %---------- Public (read/write) Properties ---------- 0088 properties 0089 end 0090 0091 %---------- Protected read-only Properties ---------- 0092 properties (SetAccess = protected) 0093 methodInfo = []; 0094 plistUsed = []; 0095 methodInvars = {}; 0096 inhists = []; 0097 proctime = []; 0098 version = '$Id: history.m,v 1.41 2008/09/08 08:30:40 hewitson Exp $'; 0099 end 0100 0101 %---------- Private Properties ---------- 0102 properties (GetAccess = public, SetAccess = private) 0103 end 0104 0105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0106 % Check property setting % 0107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0108 0109 methods 0110 function obj = set.methodInfo(obj, val) 0111 if ~(isa(val, 'minfo') || isempty(val)) 0112 error('### The value for the property ''methodInfo''\n### must be a minfo-object or empty but\n### it is from the class %s', class(val)); 0113 end 0114 obj.methodInfo = val; 0115 end 0116 function obj = set.plistUsed(obj, val) 0117 if ~(isa(val, 'plist') || isempty(val)) 0118 error('### The value for the property ''plistUsed''\n### must be a plist-object or empty but\n### it is from the class %s', class(val)); 0119 end 0120 obj.plistUsed = val; 0121 end 0122 function obj = set.methodInvars(obj, val) 0123 if ~iscell(val) 0124 error('### The value for the property ''methodInvars''\n### must be a cell-array but\n### it is from the class %s', class(val)); 0125 end 0126 obj.methodInvars = val; 0127 end 0128 function obj = set.inhists(obj, val) 0129 if ~(isa(val, 'history') || isempty(val)) 0130 error('### The value for the property ''inhists''\n### must be a history-object or empty but\n### it is from the class %s', class(val)); 0131 end 0132 obj.inhists = val; 0133 end 0134 0135 end 0136 0137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0138 % Constructor % 0139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0140 0141 methods 0142 0143 function obj = history(varargin) 0144 0145 %%% Call superclass 0146 obj = obj@ltpda_nuo(varargin{:}); 0147 0148 %%%%%%%%%% Set dafault values %%%%%%%%%% 0149 0150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% no input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0153 0154 if nargin == 0 0155 0156 % Do nothing 0157 0158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0161 elseif nargin == 1 0162 0163 %%%%%%%%%%% From File %%%%%%%%%%%%%%%% 0164 if ischar(varargin{1}) 0165 0166 filename = varargin{1}; 0167 [path, name, ext, vers] = fileparts(filename); 0168 switch ext 0169 case '.mat' 0170 obj = load(filename); 0171 obj = obj.a; 0172 case '.xml' 0173 root_node = xmlread(filename); 0174 obj = utils.helper.xmlread(root_node, 'history'); 0175 otherwise 0176 error('### Unknown file type.'); 0177 end 0178 0179 %%%%%%%%%% h = history(struct) %%%%%%%%%% 0180 elseif isstruct(varargin{1}) 0181 0182 hstruct = varargin{1}; 0183 0184 obj.methodInfo = utils.helper.struct2obj(hstruct.methodInfo, 'minfo'); 0185 obj.plistUsed = utils.helper.struct2obj(hstruct.plistUsed, 'plist'); 0186 obj.methodInvars = hstruct.methodInvars; 0187 obj.inhists = utils.helper.struct2obj(hstruct.inhists, 'history'); 0188 obj.proctime = hstruct.proctime; 0189 obj.version = hstruct.version; 0190 0191 %%%%%%%%%% h = history(history) %%%%%%%%%% 0192 elseif isa(varargin{1}, 'history') 0193 obj = copy(varargin{1}, 1); 0194 0195 %%%%%%%%%% h = history(plist) %%%%%%%%%% 0196 elseif isa(varargin{1}, 'plist') 0197 %%% is the plist is empty then return an empty history object 0198 if nparams(varargin{1}) == 0 0199 obj.plistUsed = varargin{1}; 0200 else 0201 error('### Unknown history constructor method.'); 0202 end 0203 0204 else 0205 error('### Unknown history constructor method.'); 0206 end 0207 0208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% two input %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0211 0212 elseif nargin == 2 0213 %%%%%%%%%%% Database 0214 %%%%%%%%%% h = history('database', ...) %%%%%%%%%% 0215 if isa(varargin{1}, 'database') 0216 obj = retrieve(varargin{1}, varargin{2:end}); 0217 0218 %%%%%%%%%% h = history(proctime, minfo) %%%%%%%%%% 0219 else 0220 error('### Unknown constructor method for two inputs.'); 0221 end 0222 0223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0224 %%%%%%%%%%%%%%%%%%%%%%%%%%%% three inputs %%%%%%%%%%%%%%%%%%%%%%%%%%% 0225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0226 0227 %%%%%%%%%% h = history(proctime, minfo, plist) %%%% 0228 elseif nargin == 3 0229 0230 %%% Use default values 0231 if ~isempty(varargin{1}) 0232 obj.proctime = varargin{1}; 0233 end 0234 if ~isempty(varargin{2}) 0235 obj.methodInfo = varargin{2}; 0236 end 0237 if ~isempty(varargin{3}) 0238 obj.plistUsed = varargin{3}; 0239 end 0240 0241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0242 %%%%%%%%%%%%%%%%%%%%%%%%%%%% five inputs %%%%%%%%%%%%%%%%%%%%%%%%%%% 0243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0244 0245 %%%%%%%%%% h = history(proctime, minfo, plist, in_names, in_hists) %%%% 0246 elseif nargin == 5 0247 0248 %%% Use default values 0249 if ~isempty(varargin{1}) 0250 obj.proctime = varargin{1}; 0251 end 0252 if ~isempty(varargin{2}) 0253 obj.methodInfo = varargin{2}; 0254 end 0255 if ~isempty(varargin{3}) 0256 obj.plistUsed = varargin{3}; 0257 end 0258 if ~isempty(varargin{4}) 0259 obj.methodInvars = varargin{4}; 0260 end 0261 if ~isempty(varargin{5}) 0262 obj.inhists = varargin{5}; 0263 end 0264 0265 else 0266 error('### Unknown number of constructor arguments.'); 0267 end 0268 0269 end 0270 0271 end 0272 0273 0274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0275 % Methods (public) % 0276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0277 0278 methods 0279 %%% Define Abstract methods 0280 varargout = char(varargin) 0281 varargout = copy(varargin) 0282 varargout = display(varargin) 0283 0284 varargout = getNodes(varargin) 0285 varargout = getNodes_plot(varargin) 0286 varargout = hist2dot(varargin) 0287 varargout = hist2m(varargin) 0288 varargout = plot(varargin) 0289 varargout = string(varargin) 0290 end 0291 0292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0293 % Methods (protected) % 0294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0295 0296 methods (Access = protected) 0297 end 0298 0299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0300 % Methods (Static, Public) % 0301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0302 0303 methods (Static = true) 0304 0305 varargout = update_struct(varargin); 0306 0307 function out = VEROUT() 0308 out = '$Id: history.m,v 1.41 2008/09/08 08:30:40 hewitson Exp $'; 0309 end 0310 0311 function ii = getInfo(varargin) 0312 ii = utils.helper.generic_getInfo(varargin{:}, 'history'); 0313 end 0314 0315 function out = SETS() 0316 out = {'Default'}; 0317 end 0318 0319 function out = getDefaultPlist(set) 0320 switch set 0321 case 'Default' 0322 out = plist(); 0323 0324 otherwise 0325 out = plist(); 0326 end 0327 end 0328 0329 end 0330 0331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0332 % Methods (Static, Private) % 0333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0334 0335 methods (Static = true, Access = private) 0336 end 0337 0338 end 0339 0340 0341 0342