Skip to content

Commit ffd1437

Browse files
committed
[Matlab] Consistent 'isa' class comparison use
1 parent d5db501 commit ffd1437

File tree

10 files changed

+17
-18
lines changed

10 files changed

+17
-18
lines changed

+nix/Block.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267

268268
%-- Creating a multitag requires an already existing data array
269269
function r = create_multi_tag(obj, name, type, add_data_array)
270-
if (strcmp(class(add_data_array), 'nix.DataArray'))
270+
if (isa(add_data_array, 'nix.DataArray'))
271271
addID = add_data_array.id;
272272
else
273273
addID = add_data_array;

+nix/DataArray.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
alias = 'DataArray'
1515
end
1616

17-
properties(Dependent)
17+
properties (Dependent)
1818
dimensions % should not be dynamic due to complex set operation
1919
end
2020

+nix/Feature.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
alias = 'Feature'
1515
end
1616

17-
properties(Dependent)
17+
properties (Dependent)
1818
id
1919
linkType
2020
end
@@ -45,7 +45,7 @@
4545
end
4646

4747
function [] = set_data(obj, setData)
48-
if (strcmp(class(setData), 'nix.DataArray'))
48+
if (isa(setData, 'nix.DataArray'))
4949
setData = setData.id;
5050
end
5151
fname = strcat(obj.alias, '::setData');

+nix/MultiTag.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
% ------------------
9090

9191
function r = add_feature(obj, add_this, link_type)
92-
if (strcmp(class(add_this), 'nix.DataArray'))
92+
if (isa(add_this, 'nix.DataArray'))
9393
addID = add_this.id;
9494
else
9595
addID = add_this;

+nix/NamedEntity.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
function r = compare(obj, entity)
2525
% Compares first name and second id, return > 0 if the entity
2626
% is larger than the other, 0 if both are equal, and < 0 otherwise.
27-
if (~strcmp(class(obj), class(entity)))
27+
if (~isa(obj, class(entity)))
2828
error('Only entities of the same class can be compared.');
2929
end
3030
fname = strcat(obj.alias, '::compare');

+nix/Property.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
% PROPERTY Metadata Property class
1111
% NIX metadata property
1212

13-
properties(Hidden)
13+
properties (Hidden)
1414
% namespace reference for nix-mx functions
1515
alias = 'Property'
1616
end
1717

18-
properties(Dependent)
18+
properties (Dependent)
1919
values
2020
end
2121

@@ -69,7 +69,7 @@
6969
% return value 0 means name and id of two properties are
7070
% identical, any other value means either name or id differ.
7171
function r = compare(obj, property)
72-
if (~strcmp(class(property), class(obj)))
72+
if (~isa(property, class(obj)))
7373
error('Function only supports comparison of Properties.');
7474
end
7575

+nix/Section.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
% SECTION Metadata Section class
1111
% NIX metadata section
1212

13-
properties(Hidden)
13+
properties (Hidden)
1414
% namespace reference for nix-mx functions
1515
alias = 'Section'
1616
end
@@ -143,7 +143,7 @@
143143
function r = delete_property(obj, del)
144144
if (isstruct(del) && isfield(del, 'id'))
145145
delID = del.id;
146-
elseif (strcmp(class(del), 'nix.Property'))
146+
elseif (isa(del, 'nix.Property'))
147147
delID = del.id;
148148
else
149149
delID = del;
@@ -203,16 +203,15 @@
203203
% Referring utility method
204204
% ----------------
205205

206-
methods(Access=protected)
206+
methods (Access=protected)
207207
% referring_util receives a nix entityConstructor, part of a function
208208
% name and varargin to provide abstract access to nix.Section
209209
% referringXXX and referringXXX(Block) methods.
210210
function r = referring_util(obj, entityConstructor, fsuffix, varargin)
211211
if (isempty(varargin))
212212
fname = strcat(obj.alias, '::referring', fsuffix);
213213
r = nix.Utils.fetchObjList(fname, obj.nix_handle, entityConstructor);
214-
elseif ((size(varargin, 2) > 1) || ...
215-
(~strcmp(class(varargin{1}), 'nix.Block')))
214+
elseif ((size(varargin, 2) > 1) || (~isa(varargin{1}, 'nix.Block')))
216215
error('Provide either empty arguments or a single Block entity');
217216
else
218217
fname = strcat(obj.alias, '::referringBlock', fsuffix);

+nix/SourcesMixIn.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
% has_source supports only check by id, not by name
2828
function r = has_source(obj, id_or_entity)
2929
has = id_or_entity;
30-
if (strcmp(class(has), 'nix.Source'))
30+
if (isa(has, 'nix.Source'))
3131
has = id_or_entity.id;
3232
end
3333

+nix/Tag.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
% ------------------
9292

9393
function r = add_feature(obj, add_this, link_type)
94-
if (strcmp(class(add_this), 'nix.DataArray'))
94+
if (isa(add_this, 'nix.DataArray'))
9595
addID = add_this.id;
9696
else
9797
addID = add_this;

+nix/Utils.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
end
4141

4242
function [] = add_entity(obj, add_this, nixEntity, mxMethod)
43-
if (strcmp(class(add_this), nixEntity))
43+
if (isa(add_this, nixEntity))
4444
addID = add_this.id;
4545
else
4646
addID = add_this;
@@ -66,7 +66,7 @@
6666
% The first actually removes the entity, the latter
6767
% removes only the reference to the entity.
6868
function r = delete_entity(obj, del, nixEntity, mxMethod)
69-
if (strcmp(class(del), nixEntity))
69+
if (isa(del, nixEntity))
7070
delID = del.id;
7171
else
7272
delID = del;

0 commit comments

Comments
 (0)