


EQ overloads the == operator for timeformat objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: EQ overloads the == operator for timeformat objects.
All fields are checked.
CALL: result = eq(c1,c2)
result = eq(c1,c2, exc_list)
result = eq(c1,c2, 'property1', 'property2')
result = eq(c1,c2, 'class/property', 'class/property')
EXAMPLES: result = eq(c1,c2, 'name', 'created')
result = eq(c1,c2, 'ao/name')
INPUTS: c1,c2 - input timeformat objects
exc_list - exception list
List of properties which are not checked.
OUTPUTS: If the two timeformat objects are considered equal, result == 1,
otherwise, result == 0.
VERSION: $Id: eq.m,v 1.3 2008/01/15 17:36:36 ingo Exp $
HISTORY: 29-08-2007 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function result = eq(c1,c2, varargin) 0002 % EQ overloads the == operator for timeformat objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: EQ overloads the == operator for timeformat objects. 0007 % 0008 % All fields are checked. 0009 % 0010 % CALL: result = eq(c1,c2) 0011 % result = eq(c1,c2, exc_list) 0012 % result = eq(c1,c2, 'property1', 'property2') 0013 % result = eq(c1,c2, 'class/property', 'class/property') 0014 % 0015 % EXAMPLES: result = eq(c1,c2, 'name', 'created') 0016 % result = eq(c1,c2, 'ao/name') 0017 % 0018 % INPUTS: c1,c2 - input timeformat objects 0019 % exc_list - exception list 0020 % List of properties which are not checked. 0021 % 0022 % OUTPUTS: If the two timeformat objects are considered equal, result == 1, 0023 % otherwise, result == 0. 0024 % 0025 % VERSION: $Id: eq.m,v 1.3 2008/01/15 17:36:36 ingo Exp $ 0026 % 0027 % HISTORY: 29-08-2007 M Hewitson 0028 % Creation 0029 % 0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 0032 VERSION = '$Id: eq.m,v 1.3 2008/01/15 17:36:36 ingo Exp $'; 0033 0034 % Check if this is a call for parameters or for the cvs-version number 0035 if nargin == 2 0036 if isa(c1, 'timeformat') && ischar(c2) 0037 in = char(c2); 0038 if strcmp(in, 'Params') 0039 result = plist(); 0040 return 0041 elseif strcmp(in, 'Version') 0042 result = VERSION; 0043 return 0044 end 0045 end 0046 end 0047 0048 result = 1; 0049 0050 %% Check class 0051 if ~strcmp(class(c1), class(c2)) 0052 result = 0; 0053 return 0054 end 0055 0056 fields = fieldnames(c1); 0057 0058 for ii = 1:length(fields) 0059 field = fields{ii}; 0060 0061 ck_field = {field, ['timeformat/' field]}; 0062 0063 %% Check tag 0064 if ~(any(ismember(ck_field, varargin))) 0065 0066 if isobject(c1.(field)) 0067 if ~eq(c1.(field), c2.(field), varargin{:}) 0068 result = 0; 0069 disp(sprintf('\nNOT EQUAL: %s.%s', class(c1), field)); 0070 return 0071 end 0072 else 0073 if ~isequalwithequalnans(c1.(field), c2.(field)) 0074 result = 0; 0075 disp(sprintf('\nNOT EQUAL: %s.%s', class(c1), field)); 0076 return 0077 end 0078 end 0079 0080 end 0081 end 0082 0083 0084 % function result = eq(tf1,tf2) 0085 % 0086 % % EQ overloads the == operator for timeformat objects. 0087 % % 0088 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0089 % % 0090 % % DESCRIPTION: EQ overloads the == operator for timeformat objects. 0091 % % 0092 % % Each field is checked. 0093 % % 0094 % % CALL: result = eq(tf1,tf2) 0095 % % 0096 % % INPUTS: tf1,tf2 - input plist objects 0097 % % 0098 % % OUTPUTS: If the two timeformat objects are considered equal, result == 1, 0099 % % otherwise, result == 0. 0100 % % 0101 % % VERSION: $Id: eq.m,v 1.3 2008/01/15 17:36:36 ingo Exp $ 0102 % % 0103 % % HISTORY: 29-08-2007 M Hewitson 0104 % % Creation 0105 % % 0106 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0107 % 0108 % % Check each field 0109 % result = isequal(struct(tf1), struct(tf2)); 0110 % 0111 %