Skip to content

Commit 854250a

Browse files
committed
[matlab] Cleanup File function names
Rename File function names to adhere to the Matlab naming scheme. Refactors all affected tests.
1 parent b166d7a commit 854250a

File tree

12 files changed

+218
-218
lines changed

12 files changed

+218
-218
lines changed

+nix/File.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@
3838
% Block methods
3939
% ----------------
4040

41-
function newBlock = createBlock(obj, name, type)
41+
function newBlock = create_block(obj, name, type)
4242
newBlock = nix.Block(nix_mx('File::createBlock', obj.nix_handle, name, type));
4343
end;
4444

45-
function c = blockCount(obj)
45+
function c = block_count(obj)
4646
c = nix_mx('File::blockCount', obj.nix_handle);
4747
end
4848

49-
function hasBlock = hasBlock(obj, id_or_name)
49+
function hasBlock = has_block(obj, id_or_name)
5050
hasBlock = nix_mx('File::hasBlock', obj.nix_handle, id_or_name);
5151
end;
5252

53-
function retObj = openBlock(obj, id_or_name)
53+
function retObj = open_block(obj, id_or_name)
5454
retObj = nix.Utils.open_entity(obj, ...
5555
'File::openBlock', id_or_name, @nix.Block);
5656
end
5757

58-
function delCheck = deleteBlock(obj, del)
58+
function delCheck = delete_block(obj, del)
5959
delCheck = nix.Utils.delete_entity(obj, ...
6060
del, 'nix.Block', 'File::deleteBlock');
6161
end;
@@ -64,24 +64,24 @@
6464
% Section methods
6565
% ----------------
6666

67-
function newSec = createSection(obj, name, type)
67+
function newSec = create_section(obj, name, type)
6868
newSec = nix.Section(nix_mx('File::createSection', obj.nix_handle, name, type));
6969
end;
7070

71-
function c = sectionCount(obj)
71+
function c = section_count(obj)
7272
c = nix_mx('File::sectionCount', obj.nix_handle);
7373
end
7474

75-
function hasSec = hasSection(obj, id_or_name)
75+
function hasSec = has_section(obj, id_or_name)
7676
hasSec = nix_mx('File::hasSection', obj.nix_handle, id_or_name);
7777
end;
7878

79-
function retObj = openSection(obj, id_or_name)
79+
function retObj = open_section(obj, id_or_name)
8080
retObj = nix.Utils.open_entity(obj, ...
8181
'File::openSection', id_or_name, @nix.Section);
8282
end
8383

84-
function delCheck = deleteSection(obj, del)
84+
function delCheck = delete_section(obj, del)
8585
delCheck = nix.Utils.delete_entity(obj, del, 'nix.Section', 'File::deleteSection');
8686
end;
8787
end

tests/TestBlock.m

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
function [] = test_attrs( varargin )
5050
%% Test: Access Attributes
5151
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
52-
b = f.createBlock('tagtest', 'test nixBlock');
52+
b = f.create_block('tagtest', 'test nixBlock');
5353

5454
assert(~isempty(b.id));
5555
assert(strcmp(b.name, 'tagtest'));
@@ -70,7 +70,7 @@
7070
function [] = test_create_data_array( varargin )
7171
fileName = fullfile(pwd, 'tests', 'testRW.h5');
7272
f = nix.File(fileName, nix.FileMode.Overwrite);
73-
b = f.createBlock('arraytest', 'nixblock');
73+
b = f.create_block('arraytest', 'nixblock');
7474

7575
assert(isempty(b.dataArrays));
7676

@@ -115,7 +115,7 @@
115115
fileName = fullfile(pwd, 'tests', 'testRW.h5');
116116
daType = 'nix.DataArray';
117117
f = nix.File(fileName, nix.FileMode.Overwrite);
118-
b = f.createBlock('arraytest', 'nixblock');
118+
b = f.create_block('arraytest', 'nixblock');
119119

120120
assert(isempty(b.dataArrays));
121121

@@ -155,7 +155,7 @@
155155
%% Test: delete dataArray by entity and id
156156
function [] = test_delete_data_array( varargin )
157157
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
158-
b = f.createBlock('arraytest', 'nixBlock');
158+
b = f.create_block('arraytest', 'nixBlock');
159159
tmp = b.create_data_array('dataArrayTest1', 'nixDataArray', nix.DataType.Double, [1 2]);
160160
tmp = b.create_data_array('dataArrayTest2', 'nixDataArray', nix.DataType.Double, [3 4]);
161161

@@ -170,7 +170,7 @@
170170
function [] = test_create_tag( varargin )
171171
%% Test: Create Tag
172172
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
173-
b = f.createBlock('tagtest', 'nixblock');
173+
b = f.create_block('tagtest', 'nixblock');
174174

175175
assert(isempty(b.tags));
176176

@@ -186,7 +186,7 @@
186186
%% Test: delete tag by entity and id
187187
function [] = test_delete_tag( varargin )
188188
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
189-
b = f.createBlock('tagtest', 'nixBlock');
189+
b = f.create_block('tagtest', 'nixBlock');
190190
position = [1.0 1.2 1.3 15.9];
191191
tmp = b.create_tag('tagtest1', 'nixTag', position);
192192
tmp = b.create_tag('tagtest2', 'nixTag', position);
@@ -203,7 +203,7 @@
203203
function [] = test_create_multi_tag( varargin )
204204
%% Test: Create multitag by data_array entity and data_array id
205205
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
206-
b = f.createBlock('mTagTestBlock', 'nixBlock');
206+
b = f.create_block('mTagTestBlock', 'nixBlock');
207207
tmp = b.create_data_array('mTagTestDataArray1', 'nixDataArray', nix.DataType.Double, [1 2]);
208208
tmp = b.create_data_array('mTagTestDataArray2', 'nixDataArray', nix.DataType.Double, [3 4]);
209209
assert(isempty(b.multiTags));
@@ -222,7 +222,7 @@
222222
%% Test: delete multitag by entity and id
223223
function [] = test_delete_multi_tag( varargin )
224224
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
225-
b = f.createBlock('mTagTestBlock', 'nixBlock');
225+
b = f.create_block('mTagTestBlock', 'nixBlock');
226226
tmp = b.create_data_array('mTagTestDataArray1', 'nixDataArray', nix.DataType.Double, [1 2]);
227227
tmp = b.create_multi_tag('mTagTest1', 'nixMultiTag1', b.dataArrays{1});
228228
tmp = b.create_multi_tag('mTagTest2', 'nixMultiTag2', b.dataArrays{1});
@@ -240,7 +240,7 @@
240240
%% Test: create source
241241
function [] = test_create_source ( varargin )
242242
test_file = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
243-
getBlock = test_file.createBlock('sourcetest', 'nixblock');
243+
getBlock = test_file.create_block('sourcetest', 'nixblock');
244244
assert(isempty(getBlock.sources));
245245

246246
createSource = getBlock.create_source('sourcetest','nixsource');
@@ -252,7 +252,7 @@
252252
%% Test: delete source by entity and id
253253
function [] = test_delete_source( varargin )
254254
test_file = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
255-
getBlock = test_file.createBlock('sourcetest', 'nixblock');
255+
getBlock = test_file.create_block('sourcetest', 'nixblock');
256256
tmp = getBlock.create_source('sourcetest1','nixsource');
257257
tmp = getBlock.create_source('sourcetest2','nixsource');
258258
tmp = getBlock.create_source('sourcetest3','nixsource');
@@ -269,7 +269,7 @@
269269
function [] = test_list_arrays( varargin )
270270
fileName = fullfile(pwd, 'tests', 'testRW.h5');
271271
f = nix.File(fileName, nix.FileMode.Overwrite);
272-
b = f.createBlock('arraytest', 'nixBlock');
272+
b = f.create_block('arraytest', 'nixBlock');
273273

274274
assert(isempty(b.dataArrays));
275275
tmp = b.create_data_array('arrayTest1', 'nixDataArray', nix.DataType.Double, [1 2]);
@@ -286,7 +286,7 @@
286286
function [] = test_list_sources( varargin )
287287
fileName = fullfile(pwd, 'tests', 'testRW.h5');
288288
f = nix.File(fileName, nix.FileMode.Overwrite);
289-
b = f.createBlock('sourcetest', 'nixBlock');
289+
b = f.create_block('sourcetest', 'nixBlock');
290290

291291
assert(isempty(b.sources));
292292
tmp = b.create_source('sourcetest1','nixSource');
@@ -305,7 +305,7 @@
305305
function [] = test_list_tags( varargin )
306306
fileName = fullfile(pwd, 'tests', 'testRW.h5');
307307
f = nix.File(fileName, nix.FileMode.Overwrite);
308-
b = f.createBlock('tagtest', 'nixBlock');
308+
b = f.create_block('tagtest', 'nixBlock');
309309
position = [1.0 1.2 1.3 15.9];
310310

311311
assert(isempty(b.tags));
@@ -325,7 +325,7 @@
325325
function [] = test_list_multitags( varargin )
326326
fileName = fullfile(pwd, 'tests', 'testRW.h5');
327327
f = nix.File(fileName, nix.FileMode.Overwrite);
328-
b = f.createBlock('mTagTestBlock', 'nixBlock');
328+
b = f.create_block('mTagTestBlock', 'nixBlock');
329329
tmp = b.create_data_array('mTagTestDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
330330

331331
assert(isempty(b.multiTags));
@@ -344,7 +344,7 @@
344344
function [] = test_open_array( varargin )
345345
%% Test: Open data array by ID or name
346346
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
347-
b = f.createBlock('arraytest', 'nixBlock');
347+
b = f.create_block('arraytest', 'nixBlock');
348348
daName = 'arrayTest1';
349349

350350
assert(isempty(b.dataArrays));
@@ -364,7 +364,7 @@
364364
function [] = test_open_tag( varargin )
365365
%% Test: Open tag by ID or name
366366
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
367-
b = f.createBlock('tagtest', 'nixBlock');
367+
b = f.create_block('tagtest', 'nixBlock');
368368
position = [1.0 1.2 1.3 15.9];
369369
tagName = 'tagtest1';
370370
tmp = b.create_tag(tagName, 'nixTag', position);
@@ -383,7 +383,7 @@
383383
function [] = test_open_multitag( varargin )
384384
%% Test: Open multi tag by ID or name
385385
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
386-
b = f.createBlock('mTagTestBlock', 'nixBlock');
386+
b = f.create_block('mTagTestBlock', 'nixBlock');
387387
tmp = b.create_data_array('mTagTestDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
388388
mTagName = 'mTagTest1';
389389
tmp = b.create_multi_tag(mTagName, 'nixMultiTag', b.dataArrays{1});
@@ -402,7 +402,7 @@
402402
function [] = test_open_source( varargin )
403403
%% Test: Open source by ID or name
404404
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
405-
b = f.createBlock('sourcetest', 'nixBlock');
405+
b = f.create_block('sourcetest', 'nixBlock');
406406
sName = 'sourcetest1';
407407
tmp = b.create_source(sName, 'nixSource');
408408

@@ -420,7 +420,7 @@
420420
function [] = test_has_multitag( varargin )
421421
%% Test: Block has multi tag by ID or name
422422
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
423-
b = f.createBlock('mTagTestBlock', 'nixBlock');
423+
b = f.create_block('mTagTestBlock', 'nixBlock');
424424
tmp = b.create_data_array('mTagTestDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
425425
tmp = b.create_multi_tag('mTagTest1', 'nixMultiTag', b.dataArrays{1});
426426

@@ -433,7 +433,7 @@
433433
function [] = test_has_tag( varargin )
434434
%% Test: Block has tag by ID or name
435435
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
436-
b = f.createBlock('tagtest', 'nixBlock');
436+
b = f.create_block('tagtest', 'nixBlock');
437437
tmp = b.create_tag('tagtest1', 'nixTag', [1.0 1.2 1.3 15.9]);
438438

439439
assert(b.has_tag(b.tags{1,1}.id));
@@ -448,9 +448,9 @@
448448
secName1 = 'testSection1';
449449
secName2 = 'testSection2';
450450
f = nix.File(fileName, nix.FileMode.Overwrite);
451-
tmp = f.createSection(secName1, 'nixSection');
452-
tmp = f.createSection(secName2, 'nixSection');
453-
b = f.createBlock('testBlock', 'nixBlock');
451+
tmp = f.create_section(secName1, 'nixSection');
452+
tmp = f.create_section(secName2, 'nixSection');
453+
b = f.create_block('testBlock', 'nixBlock');
454454

455455
assert(isempty(b.open_metadata));
456456
assert(isempty(f.blocks{1}.open_metadata));
@@ -475,8 +475,8 @@
475475
function [] = test_open_metadata( varargin )
476476
%% Test: Open metadata
477477
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
478-
tmp = f.createSection('testSection', 'nixSection');
479-
b = f.createBlock('testBlock', 'nixBlock');
478+
tmp = f.create_section('testSection', 'nixSection');
479+
b = f.create_block('testBlock', 'nixBlock');
480480
b.set_metadata(f.sections{1});
481481

482482
assert(strcmp(b.open_metadata.name, 'testSection'));
@@ -487,7 +487,7 @@
487487
fileName = 'testRW.h5';
488488
daName = 'hasDataArrayTest';
489489
f = nix.File(fullfile(pwd, 'tests', fileName), nix.FileMode.Overwrite);
490-
b = f.createBlock('testblock', 'nixBlock');
490+
b = f.create_block('testblock', 'nixBlock');
491491
da = b.create_data_array(daName, 'nixDataArray', nix.DataType.Double, [1 2]);
492492
daID = da.id;
493493

@@ -504,7 +504,7 @@
504504
fileName = 'testRW.h5';
505505
sName = 'sourcetest1';
506506
f = nix.File(fullfile(pwd, 'tests', fileName), nix.FileMode.Overwrite);
507-
b = f.createBlock('testblock', 'nixBlock');
507+
b = f.create_block('testblock', 'nixBlock');
508508
s = b.create_source(sName, 'nixSource');
509509
sID = s.id;
510510

@@ -523,7 +523,7 @@
523523
groupType = 'nixGroup';
524524

525525
f = nix.File(fullfile(pwd, 'tests', fileName), nix.FileMode.Overwrite);
526-
b = f.createBlock('grouptest', 'nixBlock');
526+
b = f.create_block('grouptest', 'nixBlock');
527527

528528
assert(isempty(b.groups));
529529

@@ -542,7 +542,7 @@
542542
function [] = test_has_group( varargin )
543543
groupName = 'testGroup';
544544
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
545-
b = f.createBlock('grouptest', 'nixBlock');
545+
b = f.create_block('grouptest', 'nixBlock');
546546

547547
assert(~b.has_group('I do not exist'));
548548

@@ -558,7 +558,7 @@
558558
function [] = test_get_group( varargin )
559559
groupName = 'testGroup';
560560
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
561-
b = f.createBlock('grouptest', 'nixBlock');
561+
b = f.create_block('grouptest', 'nixBlock');
562562
g = b.create_group(groupName, 'nixGroup');
563563
gID = g.id;
564564

@@ -574,7 +574,7 @@
574574
groupType = 'nixGroup';
575575

576576
f = nix.File(fullfile(pwd, 'tests', fileName), nix.FileMode.Overwrite);
577-
b = f.createBlock('grouptest', 'nixBlock');
577+
b = f.create_block('grouptest', 'nixBlock');
578578
g1 = b.create_group('testGroup1', groupType);
579579
g2 = b.create_group('testGroup2', groupType);
580580

@@ -595,7 +595,7 @@
595595
function [] = test_group_count( varargin )
596596
testFile = fullfile(pwd, 'tests', 'testRW.h5');
597597
f = nix.File(testFile, nix.FileMode.Overwrite);
598-
b = f.createBlock('testBlock', 'nixBlock');
598+
b = f.create_block('testBlock', 'nixBlock');
599599
assert(b.group_count() == 0);
600600
g = b.create_group('testGroup', 'nixGroup');
601601
assert(b.group_count() == 1);
@@ -610,7 +610,7 @@
610610
function [] = test_data_array_count( varargin )
611611
testFile = fullfile(pwd, 'tests', 'testRW.h5');
612612
f = nix.File(testFile, nix.FileMode.Overwrite);
613-
b = f.createBlock('testBlock', 'nixBlock');
613+
b = f.create_block('testBlock', 'nixBlock');
614614

615615
assert(b.data_array_count() == 0);
616616
d = b.create_data_array('testDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
@@ -626,7 +626,7 @@
626626
function [] = test_tag_count( varargin )
627627
testFile = fullfile(pwd, 'tests', 'testRW.h5');
628628
f = nix.File(testFile, nix.FileMode.Overwrite);
629-
b = f.createBlock('testBlock', 'nixBlock');
629+
b = f.create_block('testBlock', 'nixBlock');
630630

631631
assert(b.tag_count() == 0);
632632
t = b.create_tag('testTag1', 'nixTag', [1.0 1.2 1.3 15.9]);
@@ -642,7 +642,7 @@
642642
function [] = test_multi_tag_count( varargin )
643643
testFile = fullfile(pwd, 'tests', 'testRW.h5');
644644
f = nix.File(testFile, nix.FileMode.Overwrite);
645-
b = f.createBlock('testBlock', 'nixBlock');
645+
b = f.create_block('testBlock', 'nixBlock');
646646
d = b.create_data_array('mTagTestDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
647647

648648
assert(b.multi_tag_count() == 0);
@@ -659,7 +659,7 @@
659659
function [] = test_source_count( varargin )
660660
testFile = fullfile(pwd, 'tests', 'testRW.h5');
661661
f = nix.File(testFile, nix.FileMode.Overwrite);
662-
b = f.createBlock('testBlock', 'nixBlock');
662+
b = f.create_block('testBlock', 'nixBlock');
663663

664664
assert(b.source_count() == 0);
665665
s = b.create_source('testSource1', 'nixSource');

0 commit comments

Comments
 (0)