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);
        }
예제 #2
0
        private ParameterScaling parameterScalingFor(IParameter sourceParameter, IParameter targetParameter)
        {
            var parameterScaling = new ParameterScaling(sourceParameter, targetParameter);

            parameterScaling.ScalingMethod = _scalingMethodTask.DefaultMethodFor(parameterScaling);
            return(parameterScaling);
        }
예제 #3
0
        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 }));
        }
예제 #4
0
 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());
 }
예제 #5
0
 public abstract double ScaledValueFor(ParameterScaling parameterScaling);
예제 #6
0
 private double scaledPercentile(ParameterScaling parameterScaling)
 {
     return(distributedParameterFrom(parameterScaling.SourceParameter).Percentile);
 }
예제 #7
0
 protected override ICommand PerformScaling(ParameterScaling parameterScaling)
 {
     return(_parameterTask.SetParameterPercentile(parameterScaling.TargetParameter, scaledPercentile(parameterScaling)));
 }
예제 #8
0
        public override double ScaledValueFor(ParameterScaling parameterScaling)
        {
            var targetParameter = distributedParameterFrom(parameterScaling.TargetParameter);

            return(targetParameter.ValueFor(scaledPercentile(parameterScaling)));
        }
예제 #9
0
 protected override ICommand PerformScaling(ParameterScaling parameterScaling)
 {
     //nothing to do in the case of override. Return an empty command
     return(new PKSimEmptyCommand());
 }
예제 #10
0
 public override double ScaledValueFor(ParameterScaling parameterScaling)
 {
     return(parameterScaling.TargetValue);
 }
예제 #11
0
 protected abstract ICommand PerformScaling(ParameterScaling parameterScaling);
예제 #12
0
        public override double ScaledValueFor(ParameterScaling parameterScaling)
        {
            var defaultValue = parameterScaling.SourceParameter.DefaultValue.GetValueOrDefault(parameterScaling.SourceParameter.Value);

            return(parameterScaling.TargetValue * parameterScaling.SourceParameter.Value / defaultValue);
        }
예제 #13
0
 public override double ScaledValueFor(ParameterScaling parameterScaling)
 {
     return(parameterScaling.SourceParameter.Value);
 }
예제 #14
0
 protected override ICommand PerformScaling(ParameterScaling parameterScaling)
 {
     return(_parameterTask.SetParameterValue(parameterScaling.TargetParameter, parameterScaling.SourceParameter.Value));
 }
예제 #15
0
 public bool IsDefaultFor(ParameterScaling parameterScaling)
 {
     return(parameterScaling.SourceParameter.IsIndividualMoleculeGlobal());
 }
예제 #16
0
 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);
 }
예제 #19
0
 private IEnumerable <IScalingMethodSpecification> allScalingMethodFor(ParameterScaling parameterScaling)
 {
     return(_repository.Where(x => x.IsSatisfiedBy(parameterScaling)));
 }
예제 #20
0
 public IEnumerable <ScalingMethod> AllMethodsFor(ParameterScaling parameterScaling)
 {
     return(allScalingMethodFor(parameterScaling).Select(x => x.Method).ToList());
 }
예제 #21
0
 public virtual ICommand Scale(ParameterScaling parameterScaling)
 {
     parameterScaling.ResetTargetParameter();
     return(PerformScaling(parameterScaling));
 }