diff --git a/+file/fillConstructor.m b/+file/fillConstructor.m index 020ec2ca..42f67cbd 100644 --- a/+file/fillConstructor.m +++ b/+file/fillConstructor.m @@ -12,17 +12,28 @@ functionBody = [functionBody newline() bodyString]; end - functionBody = strjoin({functionBody, ... - sprintf('if strcmp(class(obj), ''%s'')', namespace.getFullClassName(name)), ... + % Build final validation/setup block that executes only for the target class, + % with conditional inclusion of mixin setup and dynamic table validation + constructorElements = {functionBody, ... + '', ... + '% Only execute validation/setup code when called directly in this class''s', ... + '% constructor, not when invoked through superclass constructor chain', ... + sprintf('if strcmp(class(obj), ''%s'') %%#ok', namespace.getFullClassName(name)), ... ' cellStringArguments = convertContainedStringsToChars(varargin(1:2:end));', ... - ' types.util.checkUnset(obj, unique(cellStringArguments));', ... - 'end'}, newline()); + ' types.util.checkUnset(obj, unique(cellStringArguments));'}; + + % Include the setup function for the HasUnnamedGroups mixin if applicable + if isa(class, 'file.Group') && class.hasAnonGroups + constructorElements{end+1} = ' obj.setupHasUnnamedGroupsMixin();'; + end - % insert check for DynamicTable class and child classes - bodyString = fillCheck(name, namespace); - if ~isempty(bodyString) - functionBody = [functionBody newline() bodyString]; + % Add custom validation for DynamicTable and its descendant classes + if isDynamicTableDescendant(name, namespace) + constructorElements{end+1} = ' types.util.dynamictable.checkConfig(obj);'; end + + constructorElements{end+1} = 'end'; + functionBody = strjoin(constructorElements, newline()); functionString = strjoin({... ['function obj = ' name '(varargin)']... @@ -169,11 +180,6 @@ fullBody = strjoin(fullBody, newline); bodystr(end+1:end+length(fullBody)+1) = [newline fullBody]; - if isa(class, 'file.Group') && class.hasAnonGroups - % Include the setup function for the HasUnnamedGroups mixin - bodystr = [bodystr, newline, 'obj.setupHasUnnamedGroupsMixin()', newline]; - end - parser = {... 'p = inputParser;',... 'p.KeepUnmatched = true;',... @@ -209,31 +215,6 @@ bodystr(end+1:end+length(parser)+1) = [newline parser]; end -function checkTxt = fillCheck(name, namespace) - checkTxt = []; - - % find if a dynamic table ancestry exists - ancestry = namespace.getRootBranch(name); - isDynamicTableDescendent = false; - for iAncestor = 1:length(ancestry) - ParentRaw = ancestry{iAncestor}; - % this is always true, we just use the proper index as typedefs may vary. - typeDefInd = isKey(ParentRaw, namespace.TYPEDEF_KEYS); - isDynamicTableDescendent = isDynamicTableDescendent ... - || strcmp('DynamicTable', ParentRaw(namespace.TYPEDEF_KEYS{typeDefInd})); - end - - if ~isDynamicTableDescendent - return; - end - - checkTxt = strjoin({ ... - sprintf('if strcmp(class(obj), ''%s'')', namespace.getFullClassName(name)), ... - ' types.util.dynamictable.checkConfig(obj);', ... - 'end',... - }, newline); -end - function docString = fillConstructorDocString(name, props, namespace, superClassProps) classVarName = name; classVarName(1) = lower(classVarName(1)); @@ -289,6 +270,26 @@ docString = char( strjoin(docString, newline) ); end +function tf = isDynamicTableDescendant(name, namespace) +% Check if name is DynamicTable or if name is for a type that inherits from DynamicTable + + tf = false; + + if strcmp(name, 'DynamicTable') + tf = true; + return + end + + ancestry = namespace.getRootBranch(name); + for iAncestor = 1:length(ancestry) + ParentRaw = ancestry{iAncestor}; + % this is always true, we just use the proper index as typedefs may vary. + typeDefInd = isKey(ParentRaw, namespace.TYPEDEF_KEYS); + ancestorName = ParentRaw(namespace.TYPEDEF_KEYS{typeDefInd}); + tf = tf || strcmp(ancestorName, 'DynamicTable'); + end +end + % Todo: Mostly duplicate code from file.fillProps. Should consolidate function typeStr = getTypeStr(prop) if ischar(prop) diff --git a/+tests/+unit/dynamicTableTest.m b/+tests/+unit/dynamicTableTest.m index 7f47ad30..3eb7a13d 100644 --- a/+tests/+unit/dynamicTableTest.m +++ b/+tests/+unit/dynamicTableTest.m @@ -55,13 +55,17 @@ function testClearDynamicTableV2_1(testCase) table = types.core.DynamicTable( ... 'description', 'test table with DynamicTableRegion', ... - 'colnames', {'dtr_col_a', 'dtr_col_b'}, ... - 'dtr_col_a', 1:4, ... - 'dtr_col_b', 5:8, ... + 'colnames', {'col_a', 'col_b'}, ... + 'col_a', types.core.VectorData('data', (1:4)'), ... + 'col_b', types.core.VectorData('data', (5:8)'), ... 'id', types.core.ElementIdentifiers('data', [0; 1; 2; 3]) ); + % Verify that vectordata has a length of 2 after adding 2 columns + testCase.verifyEqual(size(table.vectordata), uint64([2,1])) + types.util.dynamictable.clear(table) + % Verify that vectordata has a length of 0 after calling clear testCase.verifyEqual(size(table.vectordata), uint64([0,1])) nwbClearGenerated(typesOutputFolder, 'ClearCache',true) diff --git a/+types/+core/AbstractFeatureSeries.m b/+types/+core/AbstractFeatureSeries.m index 153fa00e..a364cc78 100644 --- a/+types/+core/AbstractFeatureSeries.m +++ b/+types/+core/AbstractFeatureSeries.m @@ -70,7 +70,10 @@ misc.parseSkipInvalidName(p, varargin); obj.feature_units = p.Results.feature_units; obj.features = p.Results.features; - if strcmp(class(obj), 'types.core.AbstractFeatureSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.AbstractFeatureSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/AnnotationSeries.m b/+types/+core/AnnotationSeries.m index 21853aba..10a89032 100644 --- a/+types/+core/AnnotationSeries.m +++ b/+types/+core/AnnotationSeries.m @@ -50,7 +50,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.AnnotationSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.AnnotationSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/BaseImage.m b/+types/+core/BaseImage.m index cd814a2a..d201ea69 100644 --- a/+types/+core/BaseImage.m +++ b/+types/+core/BaseImage.m @@ -37,7 +37,10 @@ addParameter(p, 'description',[]); misc.parseSkipInvalidName(p, varargin); obj.description = p.Results.description; - if strcmp(class(obj), 'types.core.BaseImage') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.BaseImage') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/BehavioralEpochs.m b/+types/+core/BehavioralEpochs.m index 2d00c31d..80d8287e 100644 --- a/+types/+core/BehavioralEpochs.m +++ b/+types/+core/BehavioralEpochs.m @@ -32,16 +32,18 @@ [obj.intervalseries, ivarargin] = types.util.parseConstrained(obj,'intervalseries', 'types.core.IntervalSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.BehavioralEpochs') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.BehavioralEpochs') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/BehavioralEvents.m b/+types/+core/BehavioralEvents.m index 8ee46485..78cff2ee 100644 --- a/+types/+core/BehavioralEvents.m +++ b/+types/+core/BehavioralEvents.m @@ -32,16 +32,18 @@ [obj.timeseries, ivarargin] = types.util.parseConstrained(obj,'timeseries', 'types.core.TimeSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.BehavioralEvents') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.BehavioralEvents') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/BehavioralTimeSeries.m b/+types/+core/BehavioralTimeSeries.m index 46f63a44..546fbec2 100644 --- a/+types/+core/BehavioralTimeSeries.m +++ b/+types/+core/BehavioralTimeSeries.m @@ -32,16 +32,18 @@ [obj.timeseries, ivarargin] = types.util.parseConstrained(obj,'timeseries', 'types.core.TimeSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.BehavioralTimeSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.BehavioralTimeSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ClusterWaveforms.m b/+types/+core/ClusterWaveforms.m index 263c403e..2044a021 100644 --- a/+types/+core/ClusterWaveforms.m +++ b/+types/+core/ClusterWaveforms.m @@ -50,7 +50,10 @@ obj.waveform_filtering = p.Results.waveform_filtering; obj.waveform_mean = p.Results.waveform_mean; obj.waveform_sd = p.Results.waveform_sd; - if strcmp(class(obj), 'types.core.ClusterWaveforms') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ClusterWaveforms') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Clustering.m b/+types/+core/Clustering.m index 31789a2e..ae16aada 100644 --- a/+types/+core/Clustering.m +++ b/+types/+core/Clustering.m @@ -50,7 +50,10 @@ obj.num = p.Results.num; obj.peak_over_rms = p.Results.peak_over_rms; obj.times = p.Results.times; - if strcmp(class(obj), 'types.core.Clustering') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Clustering') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/CompassDirection.m b/+types/+core/CompassDirection.m index ab2bf141..afe9acb9 100644 --- a/+types/+core/CompassDirection.m +++ b/+types/+core/CompassDirection.m @@ -32,16 +32,18 @@ [obj.spatialseries, ivarargin] = types.util.parseConstrained(obj,'spatialseries', 'types.core.SpatialSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.CompassDirection') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.CompassDirection') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/CorrectedImageStack.m b/+types/+core/CorrectedImageStack.m index 87b083a6..21854cb6 100644 --- a/+types/+core/CorrectedImageStack.m +++ b/+types/+core/CorrectedImageStack.m @@ -45,7 +45,10 @@ obj.corrected = p.Results.corrected; obj.original = p.Results.original; obj.xy_translation = p.Results.xy_translation; - if strcmp(class(obj), 'types.core.CorrectedImageStack') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.CorrectedImageStack') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/CurrentClampSeries.m b/+types/+core/CurrentClampSeries.m index 682c03a6..6ea81e79 100644 --- a/+types/+core/CurrentClampSeries.m +++ b/+types/+core/CurrentClampSeries.m @@ -78,7 +78,10 @@ obj.bias_current = p.Results.bias_current; obj.bridge_balance = p.Results.bridge_balance; obj.capacitance_compensation = p.Results.capacitance_compensation; - if strcmp(class(obj), 'types.core.CurrentClampSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.CurrentClampSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/CurrentClampStimulusSeries.m b/+types/+core/CurrentClampStimulusSeries.m index 50bb59f0..1139d549 100644 --- a/+types/+core/CurrentClampStimulusSeries.m +++ b/+types/+core/CurrentClampStimulusSeries.m @@ -60,7 +60,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.CurrentClampStimulusSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.CurrentClampStimulusSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/DecompositionSeries.m b/+types/+core/DecompositionSeries.m index efef4ed9..e7a5f431 100644 --- a/+types/+core/DecompositionSeries.m +++ b/+types/+core/DecompositionSeries.m @@ -80,7 +80,10 @@ obj.metric = p.Results.metric; obj.source_channels = p.Results.source_channels; obj.source_timeseries = p.Results.source_timeseries; - if strcmp(class(obj), 'types.core.DecompositionSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.DecompositionSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Device.m b/+types/+core/Device.m index 3f247749..03225f67 100644 --- a/+types/+core/Device.m +++ b/+types/+core/Device.m @@ -60,7 +60,10 @@ obj.model_name = p.Results.model_name; obj.model_number = p.Results.model_number; obj.serial_number = p.Results.serial_number; - if strcmp(class(obj), 'types.core.Device') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Device') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/DeviceModel.m b/+types/+core/DeviceModel.m index 379d8f33..0e1b6714 100644 --- a/+types/+core/DeviceModel.m +++ b/+types/+core/DeviceModel.m @@ -48,7 +48,10 @@ obj.description = p.Results.description; obj.manufacturer = p.Results.manufacturer; obj.model_number = p.Results.model_number; - if strcmp(class(obj), 'types.core.DeviceModel') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.DeviceModel') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/DfOverF.m b/+types/+core/DfOverF.m index 2e9aad41..a001b9ca 100644 --- a/+types/+core/DfOverF.m +++ b/+types/+core/DfOverF.m @@ -32,16 +32,18 @@ [obj.roiresponseseries, ivarargin] = types.util.parseConstrained(obj,'roiresponseseries', 'types.core.RoiResponseSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.DfOverF') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.DfOverF') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ElectricalSeries.m b/+types/+core/ElectricalSeries.m index 45c2e5bb..dc8f6f45 100644 --- a/+types/+core/ElectricalSeries.m +++ b/+types/+core/ElectricalSeries.m @@ -79,7 +79,10 @@ obj.channel_conversion_axis = p.Results.channel_conversion_axis; obj.electrodes = p.Results.electrodes; obj.filtering = p.Results.filtering; - if strcmp(class(obj), 'types.core.ElectricalSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ElectricalSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ElectrodeGroup.m b/+types/+core/ElectrodeGroup.m index eccdc0e1..373f54e0 100644 --- a/+types/+core/ElectrodeGroup.m +++ b/+types/+core/ElectrodeGroup.m @@ -53,7 +53,10 @@ obj.device = p.Results.device; obj.location = p.Results.location; obj.position = p.Results.position; - if strcmp(class(obj), 'types.core.ElectrodeGroup') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ElectrodeGroup') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ElectrodesTable.m b/+types/+core/ElectrodesTable.m index 5fab86da..e84071f1 100644 --- a/+types/+core/ElectrodesTable.m +++ b/+types/+core/ElectrodesTable.m @@ -101,11 +101,12 @@ obj.x = p.Results.x; obj.y = p.Results.y; obj.z = p.Results.z; - if strcmp(class(obj), 'types.core.ElectrodesTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ElectrodesTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.ElectrodesTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/EventDetection.m b/+types/+core/EventDetection.m index 4edb9024..5c1c7006 100644 --- a/+types/+core/EventDetection.m +++ b/+types/+core/EventDetection.m @@ -60,7 +60,10 @@ obj.source_idx = p.Results.source_idx; obj.times = p.Results.times; obj.times_unit = p.Results.times_unit; - if strcmp(class(obj), 'types.core.EventDetection') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.EventDetection') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/EventWaveform.m b/+types/+core/EventWaveform.m index a2385e8c..91902fdb 100644 --- a/+types/+core/EventWaveform.m +++ b/+types/+core/EventWaveform.m @@ -32,16 +32,18 @@ [obj.spikeeventseries, ivarargin] = types.util.parseConstrained(obj,'spikeeventseries', 'types.core.SpikeEventSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.EventWaveform') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.EventWaveform') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ExperimentalConditionsTable.m b/+types/+core/ExperimentalConditionsTable.m index 132f22f1..1df0713c 100644 --- a/+types/+core/ExperimentalConditionsTable.m +++ b/+types/+core/ExperimentalConditionsTable.m @@ -48,11 +48,12 @@ misc.parseSkipInvalidName(p, varargin); obj.repetitions = p.Results.repetitions; obj.repetitions_index = p.Results.repetitions_index; - if strcmp(class(obj), 'types.core.ExperimentalConditionsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ExperimentalConditionsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.ExperimentalConditionsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/ExternalImage.m b/+types/+core/ExternalImage.m index 85c0f871..dab5269e 100644 --- a/+types/+core/ExternalImage.m +++ b/+types/+core/ExternalImage.m @@ -47,7 +47,10 @@ misc.parseSkipInvalidName(p, varargin); obj.image_format = p.Results.image_format; obj.image_mode = p.Results.image_mode; - if strcmp(class(obj), 'types.core.ExternalImage') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ExternalImage') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/EyeTracking.m b/+types/+core/EyeTracking.m index a91e9eb1..57c645c5 100644 --- a/+types/+core/EyeTracking.m +++ b/+types/+core/EyeTracking.m @@ -32,16 +32,18 @@ [obj.spatialseries, ivarargin] = types.util.parseConstrained(obj,'spatialseries', 'types.core.SpatialSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.EyeTracking') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.EyeTracking') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/FeatureExtraction.m b/+types/+core/FeatureExtraction.m index afb8f420..9b5e3b3f 100644 --- a/+types/+core/FeatureExtraction.m +++ b/+types/+core/FeatureExtraction.m @@ -50,7 +50,10 @@ obj.electrodes = p.Results.electrodes; obj.features = p.Results.features; obj.times = p.Results.times; - if strcmp(class(obj), 'types.core.FeatureExtraction') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.FeatureExtraction') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/FilteredEphys.m b/+types/+core/FilteredEphys.m index c5038249..94258869 100644 --- a/+types/+core/FilteredEphys.m +++ b/+types/+core/FilteredEphys.m @@ -32,16 +32,18 @@ [obj.electricalseries, ivarargin] = types.util.parseConstrained(obj,'electricalseries', 'types.core.ElectricalSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.FilteredEphys') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.FilteredEphys') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/Fluorescence.m b/+types/+core/Fluorescence.m index ac09297b..6e265ef5 100644 --- a/+types/+core/Fluorescence.m +++ b/+types/+core/Fluorescence.m @@ -32,16 +32,18 @@ [obj.roiresponseseries, ivarargin] = types.util.parseConstrained(obj,'roiresponseseries', 'types.core.RoiResponseSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.Fluorescence') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Fluorescence') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/FrequencyBandsTable.m b/+types/+core/FrequencyBandsTable.m index 22d9d07b..e1fea696 100644 --- a/+types/+core/FrequencyBandsTable.m +++ b/+types/+core/FrequencyBandsTable.m @@ -61,11 +61,12 @@ obj.band_mean = p.Results.band_mean; obj.band_name = p.Results.band_name; obj.band_stdev = p.Results.band_stdev; - if strcmp(class(obj), 'types.core.FrequencyBandsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.FrequencyBandsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.FrequencyBandsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/GrayscaleImage.m b/+types/+core/GrayscaleImage.m index f948d6ee..d96025f5 100644 --- a/+types/+core/GrayscaleImage.m +++ b/+types/+core/GrayscaleImage.m @@ -33,7 +33,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.GrayscaleImage') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.GrayscaleImage') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/IZeroClampSeries.m b/+types/+core/IZeroClampSeries.m index 67c2983e..c8b3eb83 100644 --- a/+types/+core/IZeroClampSeries.m +++ b/+types/+core/IZeroClampSeries.m @@ -58,7 +58,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.IZeroClampSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IZeroClampSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Image.m b/+types/+core/Image.m index aef7d3dc..474add54 100644 --- a/+types/+core/Image.m +++ b/+types/+core/Image.m @@ -39,7 +39,10 @@ addParameter(p, 'resolution',[]); misc.parseSkipInvalidName(p, varargin); obj.resolution = p.Results.resolution; - if strcmp(class(obj), 'types.core.Image') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Image') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ImageMaskSeries.m b/+types/+core/ImageMaskSeries.m index 2ac80633..6556bf45 100644 --- a/+types/+core/ImageMaskSeries.m +++ b/+types/+core/ImageMaskSeries.m @@ -71,7 +71,10 @@ addParameter(p, 'masked_imageseries',[]); misc.parseSkipInvalidName(p, varargin); obj.masked_imageseries = p.Results.masked_imageseries; - if strcmp(class(obj), 'types.core.ImageMaskSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImageMaskSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ImageReferences.m b/+types/+core/ImageReferences.m index 2b18b6c9..0ed36130 100644 --- a/+types/+core/ImageReferences.m +++ b/+types/+core/ImageReferences.m @@ -29,7 +29,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.ImageReferences') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImageReferences') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ImageSegmentation.m b/+types/+core/ImageSegmentation.m index 11801451..98db9490 100644 --- a/+types/+core/ImageSegmentation.m +++ b/+types/+core/ImageSegmentation.m @@ -32,16 +32,18 @@ [obj.planesegmentation, ivarargin] = types.util.parseConstrained(obj,'planesegmentation', 'types.core.PlaneSegmentation', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.ImageSegmentation') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImageSegmentation') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ImageSeries.m b/+types/+core/ImageSeries.m index cb6b2778..116305b9 100644 --- a/+types/+core/ImageSeries.m +++ b/+types/+core/ImageSeries.m @@ -81,7 +81,10 @@ obj.external_file = p.Results.external_file; obj.external_file_starting_frame = p.Results.external_file_starting_frame; obj.format = p.Results.format; - if strcmp(class(obj), 'types.core.ImageSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImageSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Images.m b/+types/+core/Images.m index 458245ae..3f75cb23 100644 --- a/+types/+core/Images.m +++ b/+types/+core/Images.m @@ -47,7 +47,10 @@ misc.parseSkipInvalidName(p, varargin); obj.description = p.Results.description; obj.order_of_images = p.Results.order_of_images; - if strcmp(class(obj), 'types.core.Images') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Images') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ImagingPlane.m b/+types/+core/ImagingPlane.m index 426fd3b9..415b84b3 100644 --- a/+types/+core/ImagingPlane.m +++ b/+types/+core/ImagingPlane.m @@ -78,8 +78,6 @@ [obj.opticalchannel, ivarargin] = types.util.parseConstrained(obj,'opticalchannel', 'types.core.OpticalChannel', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; @@ -113,9 +111,13 @@ obj.origin_coords = p.Results.origin_coords; obj.origin_coords_unit = p.Results.origin_coords_unit; obj.reference_frame = p.Results.reference_frame; - if strcmp(class(obj), 'types.core.ImagingPlane') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImagingPlane') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ImagingRetinotopy.m b/+types/+core/ImagingRetinotopy.m index 47cd7bb8..f74cf1a4 100644 --- a/+types/+core/ImagingRetinotopy.m +++ b/+types/+core/ImagingRetinotopy.m @@ -188,7 +188,10 @@ obj.vasculature_image_dimension = p.Results.vasculature_image_dimension; obj.vasculature_image_field_of_view = p.Results.vasculature_image_field_of_view; obj.vasculature_image_format = p.Results.vasculature_image_format; - if strcmp(class(obj), 'types.core.ImagingRetinotopy') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ImagingRetinotopy') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/IndexSeries.m b/+types/+core/IndexSeries.m index 9e07114f..a22f1009 100644 --- a/+types/+core/IndexSeries.m +++ b/+types/+core/IndexSeries.m @@ -65,7 +65,10 @@ misc.parseSkipInvalidName(p, varargin); obj.indexed_images = p.Results.indexed_images; obj.indexed_timeseries = p.Results.indexed_timeseries; - if strcmp(class(obj), 'types.core.IndexSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IndexSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/IntervalSeries.m b/+types/+core/IntervalSeries.m index 4e7296bd..27d79b3d 100644 --- a/+types/+core/IntervalSeries.m +++ b/+types/+core/IntervalSeries.m @@ -50,7 +50,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.IntervalSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntervalSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/IntracellularElectrode.m b/+types/+core/IntracellularElectrode.m index 390f290d..b79c5b4f 100644 --- a/+types/+core/IntracellularElectrode.m +++ b/+types/+core/IntracellularElectrode.m @@ -78,7 +78,10 @@ obj.resistance = p.Results.resistance; obj.seal = p.Results.seal; obj.slice = p.Results.slice; - if strcmp(class(obj), 'types.core.IntracellularElectrode') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntracellularElectrode') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/IntracellularElectrodesTable.m b/+types/+core/IntracellularElectrodesTable.m index 4cedc578..33e872a7 100644 --- a/+types/+core/IntracellularElectrodesTable.m +++ b/+types/+core/IntracellularElectrodesTable.m @@ -42,11 +42,12 @@ addParameter(p, 'electrode',[]); misc.parseSkipInvalidName(p, varargin); obj.electrode = p.Results.electrode; - if strcmp(class(obj), 'types.core.IntracellularElectrodesTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntracellularElectrodesTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.IntracellularElectrodesTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/IntracellularRecordingsTable.m b/+types/+core/IntracellularRecordingsTable.m index 5f2c68db..94b52edb 100644 --- a/+types/+core/IntracellularRecordingsTable.m +++ b/+types/+core/IntracellularRecordingsTable.m @@ -56,11 +56,12 @@ obj.electrodes = p.Results.electrodes; obj.responses = p.Results.responses; obj.stimuli = p.Results.stimuli; - if strcmp(class(obj), 'types.core.IntracellularRecordingsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntracellularRecordingsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.IntracellularRecordingsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/IntracellularResponsesTable.m b/+types/+core/IntracellularResponsesTable.m index ef5f9ef6..b05bacdd 100644 --- a/+types/+core/IntracellularResponsesTable.m +++ b/+types/+core/IntracellularResponsesTable.m @@ -42,11 +42,12 @@ addParameter(p, 'response',[]); misc.parseSkipInvalidName(p, varargin); obj.response = p.Results.response; - if strcmp(class(obj), 'types.core.IntracellularResponsesTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntracellularResponsesTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.IntracellularResponsesTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/IntracellularStimuliTable.m b/+types/+core/IntracellularStimuliTable.m index afc1da5a..a2e666eb 100644 --- a/+types/+core/IntracellularStimuliTable.m +++ b/+types/+core/IntracellularStimuliTable.m @@ -50,11 +50,12 @@ misc.parseSkipInvalidName(p, varargin); obj.stimulus = p.Results.stimulus; obj.stimulus_template = p.Results.stimulus_template; - if strcmp(class(obj), 'types.core.IntracellularStimuliTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.IntracellularStimuliTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.IntracellularStimuliTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/LFP.m b/+types/+core/LFP.m index 921dedc4..001ab0c6 100644 --- a/+types/+core/LFP.m +++ b/+types/+core/LFP.m @@ -32,16 +32,18 @@ [obj.electricalseries, ivarargin] = types.util.parseConstrained(obj,'electricalseries', 'types.core.ElectricalSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.LFP') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.LFP') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/LabMetaData.m b/+types/+core/LabMetaData.m index 6f9cb0ae..a90652da 100644 --- a/+types/+core/LabMetaData.m +++ b/+types/+core/LabMetaData.m @@ -17,7 +17,10 @@ % - labMetaData (types.core.LabMetaData) - A LabMetaData object obj = obj@types.core.NWBContainer(varargin{:}); - if strcmp(class(obj), 'types.core.LabMetaData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.LabMetaData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/MotionCorrection.m b/+types/+core/MotionCorrection.m index e3ed97e8..124ffd92 100644 --- a/+types/+core/MotionCorrection.m +++ b/+types/+core/MotionCorrection.m @@ -32,16 +32,18 @@ [obj.correctedimagestack, ivarargin] = types.util.parseConstrained(obj,'correctedimagestack', 'types.core.CorrectedImageStack', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.MotionCorrection') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.MotionCorrection') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/NWBContainer.m b/+types/+core/NWBContainer.m index 02b6d2b1..0a2cd513 100644 --- a/+types/+core/NWBContainer.m +++ b/+types/+core/NWBContainer.m @@ -17,7 +17,10 @@ % - nWBContainer (types.core.NWBContainer) - A NWBContainer object obj = obj@types.hdmf_common.Container(varargin{:}); - if strcmp(class(obj), 'types.core.NWBContainer') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.NWBContainer') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/NWBData.m b/+types/+core/NWBData.m index 348806d8..eb02c7f8 100644 --- a/+types/+core/NWBData.m +++ b/+types/+core/NWBData.m @@ -29,7 +29,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.NWBData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.NWBData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/NWBDataInterface.m b/+types/+core/NWBDataInterface.m index 1012dc86..07ff8884 100644 --- a/+types/+core/NWBDataInterface.m +++ b/+types/+core/NWBDataInterface.m @@ -17,7 +17,10 @@ % - nWBDataInterface (types.core.NWBDataInterface) - A NWBDataInterface object obj = obj@types.core.NWBContainer(varargin{:}); - if strcmp(class(obj), 'types.core.NWBDataInterface') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.NWBDataInterface') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/NWBFile.m b/+types/+core/NWBFile.m index bdb882e4..0d367540 100644 --- a/+types/+core/NWBFile.m +++ b/+types/+core/NWBFile.m @@ -290,7 +290,10 @@ obj.stimulus_templates = p.Results.stimulus_templates; obj.timestamps_reference_time = p.Results.timestamps_reference_time; obj.units = p.Results.units; - if strcmp(class(obj), 'types.core.NWBFile') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.NWBFile') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/OnePhotonSeries.m b/+types/+core/OnePhotonSeries.m index bfbeba61..4dce91fc 100644 --- a/+types/+core/OnePhotonSeries.m +++ b/+types/+core/OnePhotonSeries.m @@ -104,7 +104,10 @@ obj.pmt_gain = p.Results.pmt_gain; obj.power = p.Results.power; obj.scan_line_rate = p.Results.scan_line_rate; - if strcmp(class(obj), 'types.core.OnePhotonSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.OnePhotonSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/OpticalChannel.m b/+types/+core/OpticalChannel.m index 1e3c8aa6..c9dda0ab 100644 --- a/+types/+core/OpticalChannel.m +++ b/+types/+core/OpticalChannel.m @@ -40,7 +40,10 @@ misc.parseSkipInvalidName(p, varargin); obj.description = p.Results.description; obj.emission_lambda = p.Results.emission_lambda; - if strcmp(class(obj), 'types.core.OpticalChannel') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.OpticalChannel') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/OpticalSeries.m b/+types/+core/OpticalSeries.m index 766ad368..621c47c3 100644 --- a/+types/+core/OpticalSeries.m +++ b/+types/+core/OpticalSeries.m @@ -81,7 +81,10 @@ obj.distance = p.Results.distance; obj.field_of_view = p.Results.field_of_view; obj.orientation = p.Results.orientation; - if strcmp(class(obj), 'types.core.OpticalSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.OpticalSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/OptogeneticSeries.m b/+types/+core/OptogeneticSeries.m index 0cea5f36..9e3fa8ff 100644 --- a/+types/+core/OptogeneticSeries.m +++ b/+types/+core/OptogeneticSeries.m @@ -60,7 +60,10 @@ addParameter(p, 'site',[]); misc.parseSkipInvalidName(p, varargin); obj.site = p.Results.site; - if strcmp(class(obj), 'types.core.OptogeneticSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.OptogeneticSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/OptogeneticStimulusSite.m b/+types/+core/OptogeneticStimulusSite.m index 4dacc81a..b30bbd5a 100644 --- a/+types/+core/OptogeneticStimulusSite.m +++ b/+types/+core/OptogeneticStimulusSite.m @@ -50,7 +50,10 @@ obj.device = p.Results.device; obj.excitation_lambda = p.Results.excitation_lambda; obj.location = p.Results.location; - if strcmp(class(obj), 'types.core.OptogeneticStimulusSite') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.OptogeneticStimulusSite') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/PatchClampSeries.m b/+types/+core/PatchClampSeries.m index d0070a54..88f04a8f 100644 --- a/+types/+core/PatchClampSeries.m +++ b/+types/+core/PatchClampSeries.m @@ -79,7 +79,10 @@ obj.gain = p.Results.gain; obj.stimulus_description = p.Results.stimulus_description; obj.sweep_number = p.Results.sweep_number; - if strcmp(class(obj), 'types.core.PatchClampSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.PatchClampSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/PlaneSegmentation.m b/+types/+core/PlaneSegmentation.m index e97b322a..92e7d8e0 100644 --- a/+types/+core/PlaneSegmentation.m +++ b/+types/+core/PlaneSegmentation.m @@ -76,11 +76,12 @@ obj.reference_images = p.Results.reference_images; obj.voxel_mask = p.Results.voxel_mask; obj.voxel_mask_index = p.Results.voxel_mask_index; - if strcmp(class(obj), 'types.core.PlaneSegmentation') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.PlaneSegmentation') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.PlaneSegmentation') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/Position.m b/+types/+core/Position.m index fe546460..9ca0fb84 100644 --- a/+types/+core/Position.m +++ b/+types/+core/Position.m @@ -32,16 +32,18 @@ [obj.spatialseries, ivarargin] = types.util.parseConstrained(obj,'spatialseries', 'types.core.SpatialSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.Position') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Position') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/ProcessingModule.m b/+types/+core/ProcessingModule.m index a87fd733..13c18b01 100644 --- a/+types/+core/ProcessingModule.m +++ b/+types/+core/ProcessingModule.m @@ -43,8 +43,6 @@ [obj.nwbdatainterface, ivarargin] = types.util.parseConstrained(obj,'nwbdatainterface', 'types.core.NWBDataInterface', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; @@ -52,9 +50,13 @@ addParameter(p, 'description',[]); misc.parseSkipInvalidName(p, varargin); obj.description = p.Results.description; - if strcmp(class(obj), 'types.core.ProcessingModule') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ProcessingModule') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/PupilTracking.m b/+types/+core/PupilTracking.m index 4e066bf5..c49f1223 100644 --- a/+types/+core/PupilTracking.m +++ b/+types/+core/PupilTracking.m @@ -32,16 +32,18 @@ [obj.timeseries, ivarargin] = types.util.parseConstrained(obj,'timeseries', 'types.core.TimeSeries', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.PupilTracking') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.PupilTracking') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+core/RGBAImage.m b/+types/+core/RGBAImage.m index 284628a3..0316c288 100644 --- a/+types/+core/RGBAImage.m +++ b/+types/+core/RGBAImage.m @@ -33,7 +33,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.RGBAImage') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.RGBAImage') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/RGBImage.m b/+types/+core/RGBImage.m index 3480051d..29a25ca5 100644 --- a/+types/+core/RGBImage.m +++ b/+types/+core/RGBImage.m @@ -33,7 +33,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.RGBImage') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.RGBImage') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/RepetitionsTable.m b/+types/+core/RepetitionsTable.m index f1f2ca7a..b0a97cf0 100644 --- a/+types/+core/RepetitionsTable.m +++ b/+types/+core/RepetitionsTable.m @@ -48,11 +48,12 @@ misc.parseSkipInvalidName(p, varargin); obj.sequential_recordings = p.Results.sequential_recordings; obj.sequential_recordings_index = p.Results.sequential_recordings_index; - if strcmp(class(obj), 'types.core.RepetitionsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.RepetitionsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.RepetitionsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/RoiResponseSeries.m b/+types/+core/RoiResponseSeries.m index 419e4679..548bc2a8 100644 --- a/+types/+core/RoiResponseSeries.m +++ b/+types/+core/RoiResponseSeries.m @@ -61,7 +61,10 @@ addParameter(p, 'rois',[]); misc.parseSkipInvalidName(p, varargin); obj.rois = p.Results.rois; - if strcmp(class(obj), 'types.core.RoiResponseSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.RoiResponseSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/ScratchData.m b/+types/+core/ScratchData.m index ca010396..e3517ad1 100644 --- a/+types/+core/ScratchData.m +++ b/+types/+core/ScratchData.m @@ -37,7 +37,10 @@ addParameter(p, 'notes',[]); misc.parseSkipInvalidName(p, varargin); obj.notes = p.Results.notes; - if strcmp(class(obj), 'types.core.ScratchData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.ScratchData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/SequentialRecordingsTable.m b/+types/+core/SequentialRecordingsTable.m index 16d68148..b987416a 100644 --- a/+types/+core/SequentialRecordingsTable.m +++ b/+types/+core/SequentialRecordingsTable.m @@ -53,11 +53,12 @@ obj.simultaneous_recordings = p.Results.simultaneous_recordings; obj.simultaneous_recordings_index = p.Results.simultaneous_recordings_index; obj.stimulus_type = p.Results.stimulus_type; - if strcmp(class(obj), 'types.core.SequentialRecordingsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.SequentialRecordingsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.SequentialRecordingsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/SimultaneousRecordingsTable.m b/+types/+core/SimultaneousRecordingsTable.m index bd643b0c..a04cfc29 100644 --- a/+types/+core/SimultaneousRecordingsTable.m +++ b/+types/+core/SimultaneousRecordingsTable.m @@ -48,11 +48,12 @@ misc.parseSkipInvalidName(p, varargin); obj.recordings = p.Results.recordings; obj.recordings_index = p.Results.recordings_index; - if strcmp(class(obj), 'types.core.SimultaneousRecordingsTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.SimultaneousRecordingsTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.SimultaneousRecordingsTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/SpatialSeries.m b/+types/+core/SpatialSeries.m index ecdab93f..6e561066 100644 --- a/+types/+core/SpatialSeries.m +++ b/+types/+core/SpatialSeries.m @@ -62,7 +62,10 @@ addParameter(p, 'reference_frame',[]); misc.parseSkipInvalidName(p, varargin); obj.reference_frame = p.Results.reference_frame; - if strcmp(class(obj), 'types.core.SpatialSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.SpatialSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/SpikeEventSeries.m b/+types/+core/SpikeEventSeries.m index 39ce891f..ceb31bdd 100644 --- a/+types/+core/SpikeEventSeries.m +++ b/+types/+core/SpikeEventSeries.m @@ -58,7 +58,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.SpikeEventSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.SpikeEventSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Subject.m b/+types/+core/Subject.m index 63f36880..a1ced292 100644 --- a/+types/+core/Subject.m +++ b/+types/+core/Subject.m @@ -81,7 +81,10 @@ obj.strain = p.Results.strain; obj.subject_id = p.Results.subject_id; obj.weight = p.Results.weight; - if strcmp(class(obj), 'types.core.Subject') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Subject') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/SweepTable.m b/+types/+core/SweepTable.m index a755c88d..6decf071 100644 --- a/+types/+core/SweepTable.m +++ b/+types/+core/SweepTable.m @@ -53,11 +53,12 @@ obj.series = p.Results.series; obj.series_index = p.Results.series_index; obj.sweep_number = p.Results.sweep_number; - if strcmp(class(obj), 'types.core.SweepTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.SweepTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.SweepTable') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/TimeIntervals.m b/+types/+core/TimeIntervals.m index 5f96fdac..0d622faf 100644 --- a/+types/+core/TimeIntervals.m +++ b/+types/+core/TimeIntervals.m @@ -71,11 +71,12 @@ obj.tags_index = p.Results.tags_index; obj.timeseries = p.Results.timeseries; obj.timeseries_index = p.Results.timeseries_index; - if strcmp(class(obj), 'types.core.TimeIntervals') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.TimeIntervals') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.TimeIntervals') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/TimeSeries.m b/+types/+core/TimeSeries.m index 265307fc..4b884cf9 100644 --- a/+types/+core/TimeSeries.m +++ b/+types/+core/TimeSeries.m @@ -111,7 +111,10 @@ obj.timestamps = p.Results.timestamps; obj.timestamps_interval = p.Results.timestamps_interval; obj.timestamps_unit = p.Results.timestamps_unit; - if strcmp(class(obj), 'types.core.TimeSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.TimeSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/TimeSeriesReferenceVectorData.m b/+types/+core/TimeSeriesReferenceVectorData.m index 354f517f..59d1921c 100644 --- a/+types/+core/TimeSeriesReferenceVectorData.m +++ b/+types/+core/TimeSeriesReferenceVectorData.m @@ -31,7 +31,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.TimeSeriesReferenceVectorData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.TimeSeriesReferenceVectorData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/TwoPhotonSeries.m b/+types/+core/TwoPhotonSeries.m index 828a6301..974fab06 100644 --- a/+types/+core/TwoPhotonSeries.m +++ b/+types/+core/TwoPhotonSeries.m @@ -89,7 +89,10 @@ obj.imaging_plane = p.Results.imaging_plane; obj.pmt_gain = p.Results.pmt_gain; obj.scan_line_rate = p.Results.scan_line_rate; - if strcmp(class(obj), 'types.core.TwoPhotonSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.TwoPhotonSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/Units.m b/+types/+core/Units.m index fb32fb3a..2bc4b373 100644 --- a/+types/+core/Units.m +++ b/+types/+core/Units.m @@ -98,11 +98,12 @@ obj.waveforms = p.Results.waveforms; obj.waveforms_index = p.Results.waveforms_index; obj.waveforms_index_index = p.Results.waveforms_index_index; - if strcmp(class(obj), 'types.core.Units') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.Units') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.core.Units') types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+core/VoltageClampSeries.m b/+types/+core/VoltageClampSeries.m index 003bd54e..0a95597b 100644 --- a/+types/+core/VoltageClampSeries.m +++ b/+types/+core/VoltageClampSeries.m @@ -122,7 +122,10 @@ obj.whole_cell_capacitance_comp_unit = p.Results.whole_cell_capacitance_comp_unit; obj.whole_cell_series_resistance_comp = p.Results.whole_cell_series_resistance_comp; obj.whole_cell_series_resistance_comp_unit = p.Results.whole_cell_series_resistance_comp_unit; - if strcmp(class(obj), 'types.core.VoltageClampSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.VoltageClampSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+core/VoltageClampStimulusSeries.m b/+types/+core/VoltageClampStimulusSeries.m index 678bf0fe..d719cb52 100644 --- a/+types/+core/VoltageClampStimulusSeries.m +++ b/+types/+core/VoltageClampStimulusSeries.m @@ -60,7 +60,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.core.VoltageClampStimulusSeries') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.core.VoltageClampStimulusSeries') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/AlignedDynamicTable.m b/+types/+hdmf_common/AlignedDynamicTable.m index 892079b0..7907b4d9 100644 --- a/+types/+hdmf_common/AlignedDynamicTable.m +++ b/+types/+hdmf_common/AlignedDynamicTable.m @@ -46,8 +46,6 @@ [obj.dynamictable, ivarargin] = types.util.parseConstrained(obj,'dynamictable', 'types.hdmf_common.DynamicTable', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; @@ -55,11 +53,13 @@ addParameter(p, 'categories',[]); misc.parseSkipInvalidName(p, varargin); obj.categories = p.Results.categories; - if strcmp(class(obj), 'types.hdmf_common.AlignedDynamicTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.AlignedDynamicTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); - end - if strcmp(class(obj), 'types.hdmf_common.AlignedDynamicTable') + obj.setupHasUnnamedGroupsMixin(); types.util.dynamictable.checkConfig(obj); end end diff --git a/+types/+hdmf_common/CSRMatrix.m b/+types/+hdmf_common/CSRMatrix.m index a2c93a2d..45682a3a 100644 --- a/+types/+hdmf_common/CSRMatrix.m +++ b/+types/+hdmf_common/CSRMatrix.m @@ -50,7 +50,10 @@ obj.indices = p.Results.indices; obj.indptr = p.Results.indptr; obj.shape = p.Results.shape; - if strcmp(class(obj), 'types.hdmf_common.CSRMatrix') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.CSRMatrix') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/Container.m b/+types/+hdmf_common/Container.m index 80468457..f9419e5e 100644 --- a/+types/+hdmf_common/Container.m +++ b/+types/+hdmf_common/Container.m @@ -17,7 +17,10 @@ % - container (types.hdmf_common.Container) - A Container object obj = obj@types.untyped.MetaClass(varargin{:}); - if strcmp(class(obj), 'types.hdmf_common.Container') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.Container') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/Data.m b/+types/+hdmf_common/Data.m index 87276371..b5b6717d 100644 --- a/+types/+hdmf_common/Data.m +++ b/+types/+hdmf_common/Data.m @@ -35,7 +35,10 @@ addParameter(p, 'data',[]); misc.parseSkipInvalidName(p, varargin); obj.data = p.Results.data; - if strcmp(class(obj), 'types.hdmf_common.Data') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.Data') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/DynamicTable.m b/+types/+hdmf_common/DynamicTable.m index 1126c495..41bd4b43 100644 --- a/+types/+hdmf_common/DynamicTable.m +++ b/+types/+hdmf_common/DynamicTable.m @@ -52,9 +52,13 @@ obj.colnames = p.Results.colnames; obj.description = p.Results.description; obj.id = p.Results.id; - if strcmp(class(obj), 'types.hdmf_common.DynamicTable') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.DynamicTable') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + types.util.dynamictable.checkConfig(obj); end end %% SETTERS diff --git a/+types/+hdmf_common/DynamicTableRegion.m b/+types/+hdmf_common/DynamicTableRegion.m index ad44d2c3..146e9a70 100644 --- a/+types/+hdmf_common/DynamicTableRegion.m +++ b/+types/+hdmf_common/DynamicTableRegion.m @@ -43,7 +43,10 @@ addParameter(p, 'table',[]); misc.parseSkipInvalidName(p, varargin); obj.table = p.Results.table; - if strcmp(class(obj), 'types.hdmf_common.DynamicTableRegion') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.DynamicTableRegion') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/ElementIdentifiers.m b/+types/+hdmf_common/ElementIdentifiers.m index be665c60..1f9e208c 100644 --- a/+types/+hdmf_common/ElementIdentifiers.m +++ b/+types/+hdmf_common/ElementIdentifiers.m @@ -29,7 +29,10 @@ p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.hdmf_common.ElementIdentifiers') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.ElementIdentifiers') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/SimpleMultiContainer.m b/+types/+hdmf_common/SimpleMultiContainer.m index baa722ef..947bd848 100644 --- a/+types/+hdmf_common/SimpleMultiContainer.m +++ b/+types/+hdmf_common/SimpleMultiContainer.m @@ -37,16 +37,18 @@ [obj.data, ivarargin] = types.util.parseConstrained(obj,'data', 'types.hdmf_common.Data', varargin{:}); varargin(ivarargin) = []; - obj.setupHasUnnamedGroupsMixin() - p = inputParser; p.KeepUnmatched = true; p.PartialMatching = false; p.StructExpand = false; misc.parseSkipInvalidName(p, varargin); - if strcmp(class(obj), 'types.hdmf_common.SimpleMultiContainer') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.SimpleMultiContainer') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); + obj.setupHasUnnamedGroupsMixin(); end end %% SETTERS diff --git a/+types/+hdmf_common/VectorData.m b/+types/+hdmf_common/VectorData.m index f28c2f47..dc02d100 100644 --- a/+types/+hdmf_common/VectorData.m +++ b/+types/+hdmf_common/VectorData.m @@ -57,7 +57,10 @@ obj.resolution = p.Results.resolution; obj.sampling_rate = p.Results.sampling_rate; obj.unit = p.Results.unit; - if strcmp(class(obj), 'types.hdmf_common.VectorData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.VectorData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_common/VectorIndex.m b/+types/+hdmf_common/VectorIndex.m index 1b8b53cc..839986a9 100644 --- a/+types/+hdmf_common/VectorIndex.m +++ b/+types/+hdmf_common/VectorIndex.m @@ -43,7 +43,10 @@ addParameter(p, 'target',[]); misc.parseSkipInvalidName(p, varargin); obj.target = p.Results.target; - if strcmp(class(obj), 'types.hdmf_common.VectorIndex') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_common.VectorIndex') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_experimental/EnumData.m b/+types/+hdmf_experimental/EnumData.m index a723bfdb..d4e741a4 100644 --- a/+types/+hdmf_experimental/EnumData.m +++ b/+types/+hdmf_experimental/EnumData.m @@ -39,7 +39,10 @@ addParameter(p, 'elements',[]); misc.parseSkipInvalidName(p, varargin); obj.elements = p.Results.elements; - if strcmp(class(obj), 'types.hdmf_experimental.EnumData') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_experimental.EnumData') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end diff --git a/+types/+hdmf_experimental/HERD.m b/+types/+hdmf_experimental/HERD.m index 95fa0618..993082f7 100644 --- a/+types/+hdmf_experimental/HERD.m +++ b/+types/+hdmf_experimental/HERD.m @@ -60,7 +60,10 @@ obj.keys = p.Results.keys; obj.object_keys = p.Results.object_keys; obj.objects = p.Results.objects; - if strcmp(class(obj), 'types.hdmf_experimental.HERD') + + % Only execute validation/setup code when called directly in this class's + % constructor, not when invoked through superclass constructor chain + if strcmp(class(obj), 'types.hdmf_experimental.HERD') %#ok cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); types.util.checkUnset(obj, unique(cellStringArguments)); end