Skip to content

Commit 2f89bcb

Browse files
committed
[matlab] Add NamedEntity compare method
1 parent c7ebdc3 commit 2f89bcb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

+nix/NamedEntity.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
nix.Dynamic.add_dyn_attr(obj, 'type', 'rw');
2121
nix.Dynamic.add_dyn_attr(obj, 'definition', 'rw');
2222
end
23+
24+
function res = compare(obj, entity)
25+
% Compares first name and second id, return > 0 if the entity
26+
% is larger than the other, 0 if both are equal, and < 0 otherwise.
27+
if(~strcmp(class(obj), class(entity)))
28+
error('Only entities of the same class can be compared.');
29+
end;
30+
res = nix_mx(strcat(obj.alias, '::compare'), ...
31+
obj.nix_handle, entity.nix_handle);
32+
end;
2333
end
2434

2535
end

0 commit comments

Comments
 (0)