private IOSPSuiteCommand withUpdatedDefaultStateAndValue(IOSPSuiteCommand executedCommand, IParameter parameter, bool shouldChangeVersion = true, bool shouldUpdateDefaultStateAndValueOriginForDefaultParameter = true) { if (!shouldUpdateDefaultStateAndValueOriginForDefaultParameter) { return(executedCommand); } if (!parameter.IsDefault) { return(executedCommand); } if (executedCommand.IsEmpty()) { return(executedCommand); } var macroCommand = new PKSimMacroCommand().WithHistoryEntriesFrom(executedCommand); macroCommand.Add(executedCommand); macroCommand.Add(new SetParameterDefaultStateCommand(parameter, isDefault: false) { ShouldChangeVersion = shouldChangeVersion }.Run(_executionContext).AsHidden()); var setValueOriginCommand = setParameterValueOrigin(parameter, ValueOrigin.Unknown, shouldChangeVersion).AsHidden(); macroCommand.Add(setValueOriginCommand); return(macroCommand); }
private IOSPSuiteCommand withUpdatedDefaultStateAndValueOrigin <T>( IOSPSuiteCommand executedCommand, IQuantity quantity, T buildingBlockOrSimulation, Func <IParameter, bool, T, ICommand> setParameterDefaultStateFunc, Func <IParameter, ValueOrigin, T, ICommand> setParameterValueOriginFunc ) { if (executedCommand.IsEmpty() || executedCommand.IsEmptyMacro()) { return(executedCommand); } var updateCommand = new MoBiMacroCommand(); addUpdateDefaultStateAndValueOriginCommand(updateCommand, quantity, buildingBlockOrSimulation, setParameterDefaultStateFunc, setParameterValueOriginFunc); if (updateCommand.IsEmtpy) { return(executedCommand); } var macroCommand = new MoBiMacroCommand().WithHistoryEntriesFrom(executedCommand); macroCommand.Add(executedCommand); macroCommand.AddRange(updateCommand.All()); return(macroCommand); }