function getparam(this, hCLI)
% GETPARAM  Set the component specific CLI properties

%   Author(s): J. Sun
%   Copyright 2008-2023 The MathWorks, Inc.
%     


% directly sourced

% 'TestBenchName'
% 'ForceClock'
% 'ClockHighTime'
% 'ClockLowTime'
% 'HoldTime',
% 'SetupTime',
% 'ForceClockEnable',
% 'TestBenchClockEnableDelay',
% 'ForceReset',
% 'ResetLength'
% 'HoldInputDataBetweenSamples',
% 'InitializeTestBenchInputs'
% 'MultifileTestBench',
% 'TestBenchDataPostfix',
% 'TestBenchReferencePostfix',
% 'SimulatorFlags',
% 'TestbenchCoeffStimulus',
% ErrorMargin
%TestBenchFracDelayStimulus
%GenerateCoSimModel
%TestbenchRateStimulus

[stimuli, userdefined] = getstimulus(this);
if isempty(stimuli)
    stimuli = {};
end
hCLI.TestBenchStimulus = stimuli;

if ~isempty(userdefined)
    hCLI.TestBenchUserStimulus = userdefined;
end

if this.GenerateTestBench == true
    if strcmpi(hCLI.TargetLanguage, this.TestbenchLanguage)
        hCLI.GenerateHDLTestbench = 'on';
    else
        hCLI.GenerateHDLTestbench = 'off'; % mixed language deprecated and handled separately in dialogCallback
    end  
else
     hCLI.GenerateHDLTestbench = 'off';
end

%----------------------------------------------------------------
function [stimulus, userdefined] = getstimulus(this)
all = {this.Impulse, this.Step, this.Ramp, this.Chirp, ...
        this.Noise};

responsees = {'impulse', 'step', 'ramp', 'chirp', 'noise'};
    
stimulus = [];
for i=1:length(all)
    if all{i}==true
        stimulus{end+1}= responsees{i}; %#ok<AGROW>
    end
end

userdefined = [];
if this.UserDefined == true
    userdefined = getuserdefined(this);
end

%----------------------------------------------------------------
function ud = getuserdefined(this)

ud = this.TestBenchUserStimulus;
if strcmpi(this.UserDefined, 'Off') || isempty(ud)
    ud = [];
else
    try
        temp = evaluatevars(ud);
        if ~isempty(temp)
            ud = temp;
        end
    catch e %#ok
        % Do nothing, let backend fail.
    end    
end

