Home > classes > @history > eq.m

eq

PURPOSE ^

EQ overloads the == operator for history objects.

SYNOPSIS ^

function result = eq(w1,w2)

DESCRIPTION ^

 EQ overloads the == operator for history objects.

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

 DESCRIPTION: EQ overloads the == operator for history objects.

              The 'name', 'version', 'plist', 'inhists', 'invars', 'created',
              fields are checked.
 
 CALL:        result = eq(h1,h2)
 
 INPUTS:      h1,h2 - input specwin objects

 OUTPUTS:     If the two history objects are considered equal, result == 1,
              otherwise, result == 0.
 
 VERSION:     $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $

 HISTORY:     29-08-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = eq(w1,w2)
0002 
0003 % EQ overloads the == operator for history objects.
0004 %
0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0006 %
0007 % DESCRIPTION: EQ overloads the == operator for history objects.
0008 %
0009 %              The 'name', 'version', 'plist', 'inhists', 'invars', 'created',
0010 %              fields are checked.
0011 %
0012 % CALL:        result = eq(h1,h2)
0013 %
0014 % INPUTS:      h1,h2 - input specwin objects
0015 %
0016 % OUTPUTS:     If the two history objects are considered equal, result == 1,
0017 %              otherwise, result == 0.
0018 %
0019 % VERSION:     $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $
0020 %
0021 % HISTORY:     29-08-2007 M Hewitson
0022 %                 Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 % Assume equality to begin with
0027 result = 1;
0028 
0029 %% Check name
0030 if ~strcmp(w1.name, w2.name)
0031   result = 0;
0032   return
0033 end
0034 
0035 %% Check version
0036 if ~strcmp(w1.version, w2.version)
0037   result = 0;
0038   return
0039 end
0040 
0041 %% Check plist
0042 if w1.plist ~= w2.plist
0043   results = 0;
0044   return;
0045 end
0046 
0047 %% check inhists
0048 
0049 if length(w1.inhists) ~= length(w2.inhists)
0050   result = 0;
0051   return
0052 end
0053 
0054 for j=1:length(w1.inhists)
0055   if w1.inhists(j) ~= w2.inhists(j)
0056     result = 0;
0057     return
0058   end
0059 end
0060 
0061 %% check invars
0062 if length(w1.invars) ~= length(w2.invars)
0063   result = 0;
0064   return
0065 end
0066 
0067 for j=1:length(w1.invars)
0068   if ~strcmp(w1.invars{j}, w2.invars{j})
0069     result = 0;
0070     return
0071   end
0072 end
0073 
0074 %% check created
0075 if w1.created ~= w2.created
0076   result = 0;
0077   return
0078 end

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003