diff --git a/herbert_core/utilities/classes/@hashable/eq.m b/herbert_core/utilities/classes/@hashable/eq.m index 824220e567..fb982361c3 100644 --- a/herbert_core/utilities/classes/@hashable/eq.m +++ b/herbert_core/utilities/classes/@hashable/eq.m @@ -10,14 +10,18 @@ % obj2 Object on right-hand side % % See also equal_to_tol -if ~isa(obj2,class(obj1)) - iseq = false; + +% use generic overloadable methods to compare object's size and shape +% as they are overloadable and may be different for children +iseq = eq_to_tol_type_equal(obj1,obj2,'',''); +if ~iseq return; end -if ~all(size(obj1)==size(obj2)) - iseq = false; +iseq = eq_to_tol_shape_equal(obj1,obj2,'','',false); +if ~iseq return; end + for i=1:numel(obj1) [~,hash1] = build_hash(obj1(i)); [~,hash2] = build_hash(obj2(i)); diff --git a/herbert_core/utilities/classes/@hashable/private/equal_to_tol_single_.m b/herbert_core/utilities/classes/@hashable/private/equal_to_tol_single_.m index 10ee0ed6e8..387438dd7e 100644 --- a/herbert_core/utilities/classes/@hashable/private/equal_to_tol_single_.m +++ b/herbert_core/utilities/classes/@hashable/private/equal_to_tol_single_.m @@ -2,7 +2,8 @@ % Compare single pair of hashable objects % % internal procedure used by equal_to_toll method to compare -% single pair of hashable objects +% single pair of hashable objects from possible array of such objects +% % Input: % obj -- first object to compare % other_obj -- second object to compare diff --git a/herbert_core/utilities/classes/@serializable/ne.m b/herbert_core/utilities/classes/@serializable/ne.m deleted file mode 100644 index 3366bfa760..0000000000 --- a/herbert_core/utilities/classes/@serializable/ne.m +++ /dev/null @@ -1,21 +0,0 @@ -function isne = ne (obj1, obj2) -% Return a logical variable stating if two serializable objects are unequal or not -% -% >> [iseq, mess] = ne (obj1, obj2) -% -% Input: -% ------ -% obj1 Object on left-hand side -% -% obj2 Object on right-hand side -% -% Optional: -% p1, p2,... Any set of parameters that the equal_to_tol function accepts -% -% See also equal_to_tol - -% TODO: can be done more efficiently as eq needs to check all -% the fields and ne may return when found first non-equal field - -isne = ~eq(obj1,obj2); - diff --git a/herbert_core/utilities/classes/@serializable/serializable.m b/herbert_core/utilities/classes/@serializable/serializable.m index f037074d5a..2e7960bbab 100644 --- a/herbert_core/utilities/classes/@serializable/serializable.m +++ b/herbert_core/utilities/classes/@serializable/serializable.m @@ -311,9 +311,12 @@ iseq = equal_to_tol(obj1,obj2); end - % Return logical variable stating if two serializable objects are - % unequal or not - isne = ne (obj1, obj2) + function isne = ne (obj1, obj2) + % Return logical variable stating if two serializable objects are + % unequal or not. Should be optimized for comparing ne. + isne = ~equal_to_tol(obj1,obj2); + end + % Return logical variable stating if two serializable objects are equal % or not given some conditions of their equality.