Home > classes > @history > history.m

history

PURPOSE ^

HISTORY History object class constructor.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 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.38 2008/08/11 07:25:40 hewitson Exp $

 HISTORY:     19-05-2008 Diepholz
                 Creation.

 SEE ALSO:    ltpda_obj, ltpda_nuo, minfo, plist

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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.38 2008/08/11 07:25: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   end
0099 
0100   %---------- Private Properties ----------
0101   properties (GetAccess = public, SetAccess = private)
0102   end
0103 
0104   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0105   %                          Check property setting                           %
0106   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0107 
0108   methods
0109     function obj = set.methodInfo(obj, val)
0110       if ~(isa(val, 'minfo') || isempty(val))
0111         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));
0112       end
0113       obj.methodInfo = val;
0114     end
0115     function obj = set.plistUsed(obj, val)
0116       if ~(isa(val, 'plist') || isempty(val))
0117         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));
0118       end
0119       obj.plistUsed = val;
0120     end
0121     function obj = set.methodInvars(obj, val)
0122       if ~iscell(val)
0123         error('### The value for the property ''methodInvars''\n### must be a cell-array but\n### it is from the class %s', class(val));
0124       end
0125       obj.methodInvars = val;
0126     end
0127     function obj = set.inhists(obj, val)
0128       if ~(isa(val, 'history') || isempty(val))
0129         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));
0130       end
0131       obj.inhists = val;
0132     end
0133 
0134   end
0135 
0136   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0137   %                                Constructor                                %
0138   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0139 
0140   methods
0141 
0142     function obj = history(varargin)
0143 
0144       %%% Call superclass
0145       obj = obj@ltpda_nuo(varargin{:});
0146 
0147       %%%%%%%%%%   Set dafault values   %%%%%%%%%%
0148       %%% Exept for a struct as an input
0149       if ~(nargin == 1 && isstruct(varargin{1}))
0150         % set version
0151         obj.setVersion('$Id: history.m,v 1.38 2008/08/11 07:25:40 hewitson Exp $');
0152       end
0153 
0154       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0155       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%   no input   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0156       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0157 
0158       if nargin == 0
0159 
0160         % Do nothing
0161 
0162         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0163         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%   one input   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0164         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0165       elseif nargin == 1
0166 
0167         %%%%%%%%%%% From File %%%%%%%%%%%%%%%%
0168         if ischar(varargin{1})
0169 
0170           filename = varargin{1};
0171           [path, name, ext, vers] = fileparts(filename);
0172           switch ext
0173             case '.mat'
0174               obj = load(filename);
0175               obj = obj.a;
0176             case '.xml'
0177               root_node = xmlread(filename);
0178               obj = utils.helper.xmlread(root_node, 'history');
0179             otherwise
0180               error('### Unknown file type.');
0181           end
0182 
0183           %%%%%%%%%%  h = history(struct)   %%%%%%%%%%
0184         elseif isstruct(varargin{1})
0185 
0186           hstruct = varargin{1};
0187 
0188           obj.methodInfo   = utils.helper.struct2obj(hstruct.methodInfo, 'minfo');
0189           obj.plistUsed    = utils.helper.struct2obj(hstruct.plistUsed, 'plist');
0190           obj.methodInvars = hstruct.methodInvars;
0191           obj.inhists      = utils.helper.struct2obj(hstruct.inhists, 'history');
0192           obj.proctime     = hstruct.proctime;
0193 
0194           %%%%%%%%%%  h = history(history)   %%%%%%%%%%
0195         elseif isa(varargin{1}, 'history')
0196           obj = copy(varargin{1}, 1);
0197 
0198           %%%%%%%%%%  h = history(plist)   %%%%%%%%%%
0199         elseif isa(varargin{1}, 'plist')
0200           %%% is the plist is empty then return an empty history object
0201           if nparams(varargin{1}) == 0
0202             obj.plistUsed = varargin{1};
0203           else
0204             error('### Unknown history constructor method.');
0205           end
0206 
0207         else
0208           error('### Unknown history constructor method.');
0209         end
0210 
0211         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0212         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%   two input   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0213         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0214 
0215       elseif nargin == 2
0216         %%%%%%%%%%% Database
0217         %%%%%%%%%%  h = history('database', ...)   %%%%%%%%%%
0218         if isa(varargin{1}, 'database')
0219           obj = retrieve(varargin{1}, varargin{2:end});
0220 
0221           %%%%%%%%%%  h = history(proctime, minfo)   %%%%%%%%%%
0222         else
0223           error('### Unknown constructor method for two inputs.');
0224         end
0225 
0226         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0227         %%%%%%%%%%%%%%%%%%%%%%%%%%%%   three inputs   %%%%%%%%%%%%%%%%%%%%%%%%%%%
0228         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0229 
0230         %%%%%%%%%%  h = history(proctime, minfo, plist)  %%%%
0231       elseif nargin == 3
0232 
0233         %%% Use default values
0234         if ~isempty(varargin{1})
0235           obj.proctime = varargin{1};
0236         end
0237         if ~isempty(varargin{2})
0238           obj.methodInfo   = varargin{2};
0239         end
0240         if ~isempty(varargin{3})
0241           obj.plistUsed    = varargin{3};
0242         end
0243 
0244         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0245         %%%%%%%%%%%%%%%%%%%%%%%%%%%%   five  inputs   %%%%%%%%%%%%%%%%%%%%%%%%%%%
0246         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0247 
0248         %%%%%%%%%%  h = history(proctime, minfo, plist, in_names, in_hists)  %%%%
0249       elseif nargin == 5
0250 
0251         %%% Use default values
0252         if ~isempty(varargin{1})
0253           obj.proctime = varargin{1};
0254         end
0255         if ~isempty(varargin{2})
0256           obj.methodInfo   = varargin{2};
0257         end
0258         if ~isempty(varargin{3})
0259           obj.plistUsed    = varargin{3};
0260         end
0261         if ~isempty(varargin{4})
0262           obj.methodInvars = varargin{4};
0263         end
0264         if ~isempty(varargin{5})
0265           obj.inhists      = varargin{5};
0266         end
0267 
0268       else
0269         error('### Unknown number of constructor arguments.');
0270       end
0271 
0272     end
0273 
0274   end
0275 
0276 
0277   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0278   %                              Methods (public)                             %
0279   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0280 
0281   methods
0282     %%% Define Abstract methods
0283     varargout = char(varargin)
0284     varargout = copy(varargin)
0285     varargout = display(varargin)
0286 
0287     varargout = getNodes(varargin)
0288     varargout = getNodes_plot(varargin)
0289     varargout = hist2dot(varargin)
0290     varargout = hist2m(varargin)
0291     varargout = plot(varargin)
0292     varargout = string(varargin)
0293   end
0294 
0295   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0296   %                              Methods (protected)                          %
0297   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0298 
0299   methods (Access = protected)
0300   end
0301 
0302   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0303   %                          Methods (Static, Public)                         %
0304   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0305 
0306   methods (Static = true)
0307 
0308     varargout = update_struct(varargin);
0309 
0310     function out = VEROUT()
0311       out = '$Id: history.m,v 1.38 2008/08/11 07:25:40 hewitson Exp $';
0312     end
0313 
0314     function ii = getInfo(varargin)
0315       ii = utils.helper.generic_getInfo(varargin{:}, 'history');
0316     end
0317 
0318     function out = SETS()
0319       out = {'Default'};
0320     end
0321 
0322     function out = getDefaultPlist(set)
0323       switch set
0324         case 'Default'
0325           out = plist();
0326 
0327         otherwise
0328           out = plist();
0329       end
0330     end
0331 
0332   end
0333 
0334   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0335   %                          Methods (Static, Private)                        %
0336   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0337 
0338   methods (Static = true, Access = private)
0339   end
0340 
0341 end
0342 
0343 
0344 
0345

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003