Home > classes > @provenance > isvalid.m

isvalid

PURPOSE ^

ISVALID tests if the given provenance has all the correct fields of the correct type.

SYNOPSIS ^

function varargout = isvalid(varargin)

DESCRIPTION ^

 ISVALID tests if the given provenance has all the correct fields of the correct type.

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

 DESCRIPTION: ISVALID tests if the given provenance has all the correct fields of the
              correct type.

 CALL:        isvalid(provenance);

              Returns 1 is provenance is a valid PROVENANCE-object; 0 otherwise.

              The following call returns a parameter list object that
              contains the default parameter values:
              >> pl = isvalid(provenance, 'Params')

              The following call returns the cvs version number:
              >> ver = isvalid(provenance, 'Version')

              The following call returns the category:
              >> ver = isvalid(provenance, 'Category')

 VERSION:     $Id: isvalid.m,v 1.1 2008/02/14 13:48:34 ingo Exp $

 HISTORY:     14-02-2008 Diepholz
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = isvalid(varargin)
0002 % ISVALID tests if the given provenance has all the correct fields of the correct type.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: ISVALID tests if the given provenance has all the correct fields of the
0007 %              correct type.
0008 %
0009 % CALL:        isvalid(provenance);
0010 %
0011 %              Returns 1 is provenance is a valid PROVENANCE-object; 0 otherwise.
0012 %
0013 %              The following call returns a parameter list object that
0014 %              contains the default parameter values:
0015 %              >> pl = isvalid(provenance, 'Params')
0016 %
0017 %              The following call returns the cvs version number:
0018 %              >> ver = isvalid(provenance, 'Version')
0019 %
0020 %              The following call returns the category:
0021 %              >> ver = isvalid(provenance, 'Category')
0022 %
0023 % VERSION:     $Id: isvalid.m,v 1.1 2008/02/14 13:48:34 ingo Exp $
0024 %
0025 % HISTORY:     14-02-2008 Diepholz
0026 %                 Creation
0027 %
0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0029 
0030 VERSION  = '$Id: isvalid.m,v 1.1 2008/02/14 13:48:34 ingo Exp $';
0031 CATEGORY = 'Helper';
0032 
0033 % 'Params', 'Version', 'Category' Call
0034 
0035 if nargin == 2
0036   if isa(varargin{1}, 'provenance') && strcmp(varargin{2}, 'Params')
0037     varargout{1} = plist();
0038     return
0039   elseif isa(varargin{1}, 'provenance') && strcmp(varargin{2}, 'Version')
0040     varargout{1} = VERSION;
0041     return
0042   elseif isa(varargin{1}, 'provenance') && strcmp(varargin{2}, 'Category')
0043     varargout{1} = CATEGORY;
0044     return
0045   end
0046 end
0047 
0048 objs = [];
0049 for j=1:nargin
0050   if isa(varargin{j}, 'provenance')
0051     objs = [objs varargin{j}];
0052   end
0053 end
0054 
0055 res = zeros(size(objs));
0056 for j=1:numel(objs)
0057   obj = objs(j);
0058   if ischar    (obj.creator)          && ...
0059      isa       (obj.created, 'time')  && ...
0060      ischar    (obj.ip)               && ...
0061      ischar    (obj.hostname)         && ...
0062      ischar    (obj.os)               && ...
0063      ischar    (obj.matlab_version)   && ...
0064      ischar    (obj.sigproc_version)  && ...
0065      ischar    (obj.ltpda_version)
0066 
0067     res(j) = 1;
0068   else
0069     res(j) = 0;
0070   end
0071 end
0072 
0073 varargout{1} = res;
0074

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003