public bool IsSatisfiedBy(ParameterScaling parameterScaling) { //changed by user! var originParameter = parameterScaling.SourceParameter; if (originParameter.IsFixedValue) { return(true); } var defaultValue = originParameter.DefaultValue; if (!defaultValue.HasValue) { return(false); } //same value and default, no need for ratio if (ValueComparer.AreValuesEqual(originParameter.Value, defaultValue.Value)) { return(false); } //same target and default, not need for ratio (equivalent to keep) if (ValueComparer.AreValuesEqual(parameterScaling.TargetParameter.Value, defaultValue.Value)) { return(false); } //only scake with ration if default !=0 return(defaultValue.Value != 0); }
private ParameterScaling parameterScalingFor(IParameter sourceParameter, IParameter targetParameter) { var parameterScaling = new ParameterScaling(sourceParameter, targetParameter); parameterScaling.ScalingMethod = _scalingMethodTask.DefaultMethodFor(parameterScaling); return(parameterScaling); }
protected override ICommand PerformScaling(ParameterScaling parameterScaling) { var(sourceParameter, targetParameter) = parameterScaling; var updateValueCommand = _parameterTask.SetParameterValue(targetParameter, sourceParameter.Value); var updateValueOriginCommand = _parameterTask.SetParameterValueOrigin(targetParameter, sourceParameter.ValueOrigin); return(new PKSimMacroCommand(new[] { updateValueCommand, updateValueOriginCommand })); }
public ScalingMethod DefaultMethodFor(ParameterScaling parameterScaling) { foreach (var scalingMethodSpecification in allScalingMethodFor(parameterScaling)) { if (scalingMethodSpecification.IsDefaultFor(parameterScaling)) { return(scalingMethodSpecification.Method); } } //default not found, return our default scaling method return(new KeepScalingMethod()); }
public abstract double ScaledValueFor(ParameterScaling parameterScaling);
private double scaledPercentile(ParameterScaling parameterScaling) { return(distributedParameterFrom(parameterScaling.SourceParameter).Percentile); }
protected override ICommand PerformScaling(ParameterScaling parameterScaling) { return(_parameterTask.SetParameterPercentile(parameterScaling.TargetParameter, scaledPercentile(parameterScaling))); }
public override double ScaledValueFor(ParameterScaling parameterScaling) { var targetParameter = distributedParameterFrom(parameterScaling.TargetParameter); return(targetParameter.ValueFor(scaledPercentile(parameterScaling))); }
protected override ICommand PerformScaling(ParameterScaling parameterScaling) { //nothing to do in the case of override. Return an empty command return(new PKSimEmptyCommand()); }
public override double ScaledValueFor(ParameterScaling parameterScaling) { return(parameterScaling.TargetValue); }
protected abstract ICommand PerformScaling(ParameterScaling parameterScaling);
public override double ScaledValueFor(ParameterScaling parameterScaling) { var defaultValue = parameterScaling.SourceParameter.DefaultValue.GetValueOrDefault(parameterScaling.SourceParameter.Value); return(parameterScaling.TargetValue * parameterScaling.SourceParameter.Value / defaultValue); }
public override double ScaledValueFor(ParameterScaling parameterScaling) { return(parameterScaling.SourceParameter.Value); }
protected override ICommand PerformScaling(ParameterScaling parameterScaling) { return(_parameterTask.SetParameterValue(parameterScaling.TargetParameter, parameterScaling.SourceParameter.Value)); }
public bool IsDefaultFor(ParameterScaling parameterScaling) { return(parameterScaling.SourceParameter.IsIndividualMoleculeGlobal()); }
public bool IsSatisfiedBy(ParameterScaling parameterScaling) { //Satisfied by all parameter scaling return(true); }
public bool IsDefaultFor(ParameterScaling parameterScaling) { return(!parameterScaling.IsDistributedScaling); }
public bool IsDefaultFor(ParameterScaling parameterSatifyingSpecification) { return(!parameterSatifyingSpecification.IsDistributedScaling); }
private IEnumerable <IScalingMethodSpecification> allScalingMethodFor(ParameterScaling parameterScaling) { return(_repository.Where(x => x.IsSatisfiedBy(parameterScaling))); }
public IEnumerable <ScalingMethod> AllMethodsFor(ParameterScaling parameterScaling) { return(allScalingMethodFor(parameterScaling).Select(x => x.Method).ToList()); }
public virtual ICommand Scale(ParameterScaling parameterScaling) { parameterScaling.ResetTargetParameter(); return(PerformScaling(parameterScaling)); }