public virtual void SetParameterUnit(IParameterDTO parameterDTO, Unit displayUnit)
        {
            var oldDisplayValue = parameterDTO.Value;

            parameterDTO.Parameter.DisplayUnit = displayUnit;
            SetParameterValue(parameterDTO, oldDisplayValue);
        }
예제 #2
0
        private void addFormulaToolTipTo(SuperToolTip toolTip, IParameterDTO parameterDTO)
        {
            if (parameterDTO.FormulaType != FormulaType.Rate)
            {
                return;
            }

            var formula = parameterDTO.Parameter.Formula as ExplicitFormula;

            if (formula == null)
            {
                return;
            }

            toolTip.Items.AddSeparator();
            toolTip.WithTitle(PKSimConstants.Information.Formula);
            toolTip.WithText(formula.FormulaString);

            toolTip.Items.AddSeparator();
            toolTip.WithTitle(PKSimConstants.Information.ObjectReferences);

            var sb = new StringBuilder();

            foreach (var objectPath in formula.ObjectPaths)
            {
                sb.AppendLine(string.Format("<I>{0}</I> is defined as: {1}", objectPath.Alias, displayObjectPathFrom(objectPath)));
            }

            toolTip.WithText(sb.ToString());
        }
        protected override void Context()
        {
            _sensitivityAnalysisParametersView = A.Fake <ISensitivityAnalysisParametersView>();
            _sensitivityParameterFactory       = A.Fake <ISensitivityParameterFactory>();
            _sensitivityParameterToSensitivityParameterDTOMapper = A.Fake <ISensitivityParameterToSensitivityParameterDTOMapper>();
            _sensitivityAnalysisSetNMaxPresenter  = A.Fake <ISensitivityAnalysisSetValuePresenter>();
            _sensitivityAnalysisSetRangePresenter = A.Fake <ISensitivityAnalysisSetValuePresenter>();
            _sensitivityAnalysisTask = A.Fake <ISensitivityAnalysisTask>();

            sut = new SensitivityAnalysisParametersPresenter(_sensitivityAnalysisParametersView, _sensitivityParameterFactory,
                                                             _sensitivityParameterToSensitivityParameterDTOMapper, _sensitivityAnalysisSetNMaxPresenter,
                                                             _sensitivityAnalysisSetRangePresenter, _sensitivityAnalysisTask);
            _sensitivityAnalysis = new SensitivityAnalysis();

            _parameterDTO = A.Fake <IParameterDTO>();
            A.CallTo(() => _parameterDTO.Value).Returns(4.0);
            _selectedSensitivityParameter   = A.Fake <SensitivityParameter>();
            _unSelectedSensitivityParameter = A.Fake <SensitivityParameter>();
            _sensitivityAnalysis.AddSensitivityParameter(_selectedSensitivityParameter);
            _sensitivityAnalysis.AddSensitivityParameter(_unSelectedSensitivityParameter);
            A.CallTo(() => _selectedSensitivityParameter.NumberOfStepsParameter).Returns(new Parameter());
            A.CallTo(() => _selectedSensitivityParameter.VariationRangeParameter).Returns(new Parameter());
            A.CallTo(() => _unSelectedSensitivityParameter.NumberOfStepsParameter).Returns(new Parameter());
            A.CallTo(() => _unSelectedSensitivityParameter.VariationRangeParameter).Returns(new Parameter());
            _sensitivityParameterDTO = new SensitivityParameterDTO(_selectedSensitivityParameter);
            A.CallTo(() => _sensitivityAnalysisParametersView.SelectedParameters()).Returns(new[] { _sensitivityParameterDTO });

            A.CallTo(() => _sensitivityParameterToSensitivityParameterDTOMapper.MapFrom(_selectedSensitivityParameter)).Returns(_sensitivityParameterDTO);
            A.CallTo(() => _sensitivityParameterToSensitivityParameterDTOMapper.MapFrom(_unSelectedSensitivityParameter)).Returns(new SensitivityParameterDTO(_unSelectedSensitivityParameter));
        }
예제 #4
0
 protected override void Context()
 {
     base.Context();
     _newDisplayUnit    = A.Fake <Unit>();;
     _minValueDTO       = A.Fake <IParameterDTO>();
     _minValueDTO.Value = 5;
 }
예제 #5
0
 public void SetParameterValue(IParameterDTO parameterDTO, double valueInGuiUnit)
 {
     if (parameterDTO == molWeightEffParameter)
     {
         return;
     }
     AddCommand(_parameterTask.SetParameterDisplayValue(parameterDTO.Parameter, valueInGuiUnit));
 }
예제 #6
0
        public void SetParameterUnit(IParameterDTO parameterDTO, Unit newUnit)
        {
            var parameter = parameterDTO.Parameter;

            AddCommand(_simulation != null
            ? _quantityTask.SetQuantityDisplayUnit(parameter, newUnit, _simulation)
            : _quantityTask.SetQuantityDisplayUnit(parameter, newUnit, _simulationSettings));
        }
예제 #7
0
        public SuperToolTip ToolTipFor(IParameterDTO parameterDTO)
        {
            var toolTip = CreateToolTip(parameterDTO.Description, PKSimConstants.Information.ParameterDescription);

            addValueDescriptionToolTip(toolTip, parameterDTO);
            addFormulaToolTipTo(toolTip, parameterDTO);
            return(toolTip);
        }
 public void SetDefaultParameters(IParameterDTO parameterAge, IParameterDTO parameterHeight, IParameterDTO parameterWeight, IParameterDTO parameterBMI, IParameterDTO parameterGestationalAge)
 {
     ParameterWeight         = parameterWeight;
     ParameterAge            = parameterAge;
     ParameterHeight         = parameterHeight;
     ParameterBMI            = parameterBMI;
     ParameterGestationalAge = parameterGestationalAge;
 }
 protected override void Context()
 {
     base.Context();
     _parameter = A.Fake <IParameterDTO>();
     _expressionParameterDTO = new ExpressionParameterDTO {
         Parameter = _parameter, GroupName = CoreConstants.Groups.VASCULAR_SYSTEM
     };
 }
 private static string displayUnit(IParameterDTO parameterDTO)
 {
     if (parameterDTO.DisplayUnit == null)
     {
         return(string.Empty);
     }
     return(parameterDTO.DisplayUnit.ToString());
 }
예제 #11
0
 private RepositoryItem getPercentileRepository(IParameterDTO parameterDTO)
 {
     if (_presenter.ParameterIsDistributed(parameterDTO))
     {
         return(_progressBarRepository);
     }
     return(_repositoryForStandardParameter);
 }
예제 #12
0
 private void setParameterUnit(IParameterDTO parameterDTO, Unit newUnit)
 {
     this.DoWithinExceptionHandler(() =>
     {
         gridViewIntervals.CloseEditor();
         _presenter.SetParameterUnit(parameterDTO, newUnit);
     });
 }
 public void ConfigureScaling(Individual sourceIndividual, Individual targetIndividual)
 {
     ScalingPerformed      = false;
     Weight                = _parameterDTOMapper.MapFrom(targetIndividual.WeightParameter);
     _parameterScalingList = _individualScalingTask.AllParameterScalingsFrom(sourceIndividual, targetIndividual).ToList();
     _needWeight           = weightShouldBeDisplayed();
     refreshView();
 }
예제 #14
0
        public void SetParameterValue(IParameterDTO parameterDTO, double valuevalueInDisplayUnit)
        {
            var parameter = parameterDTO.Parameter;

            AddCommand(_simulation != null
            ? _quantityTask.SetQuantityDisplayValue(parameter, valuevalueInDisplayUnit, _simulation)
            : _quantityTask.SetQuantityDisplayValue(parameter, valuevalueInDisplayUnit, _simulationSettings));
        }
예제 #15
0
 private void setParameterUnit(IParameterDTO parameterDTO, Unit newUnit)
 {
     OnEvent(() =>
     {
         _gridView.CloseEditor();
         _presenter.SetParameterUnit(parameterDTO, newUnit);
     });
 }
예제 #16
0
        public bool IsSetByUser(IParameterDTO parameterDTO)
        {
            if (parameterDTO.Parameter == null)
            {
                return(false);
            }

            return(parameterDTO.Parameter.ValueDiffersFromDefault());
        }
예제 #17
0
        public virtual bool CanEditValueOrigin(IParameterDTO parameterDTO)
        {
            if (!CanEditParameter(parameterDTO))
            {
                return(false);
            }

            return(parameterIsSingleInstance(parameterDTO));
        }
 public IndividualScalingConfigurationPresenter(IIndividualScalingConfigurationView view, IIndividualScalingTask individualScalingTask,
                                                IParameterScalingToParameterScalingDTOMapper mapper, IScalingMethodTask scalingMethodTask, IParameterToParameterDTOMapper parameterDTOMapper) : base(view)
 {
     _individualScalingTask = individualScalingTask;
     _mapper             = mapper;
     _scalingMethodTask  = scalingMethodTask;
     _parameterDTOMapper = parameterDTOMapper;
     Weight = new NullParameterDTO();
 }
예제 #19
0
        private bool parameterIsSingleInstance(IParameterDTO parameterDTO)
        {
            if (!parameterDTO.Parameter.BuildingBlockType.IsOneOf(PKSimBuildingBlockType.Compound, PKSimBuildingBlockType.Protocol))
            {
                return(true);
            }

            return(!parameterDTO.NameIsOneOf(CoreConstants.Parameters.AllParametersWithLockedValueOriginInSimulation));
        }
예제 #20
0
        protected override SuperToolTip GetToolTipFor(IParameterDTO parameterDTO, GridHitInfo hi)
        {
            if (hi.Column == _columnFavorites.XtraColumn)
            {
                return(_toolTipCreator.CreateToolTip(PKSimConstants.UI.AddParameterAsFavorites(parameterDTO.DisplayName), PKSimConstants.UI.FavoritesToolTip));
            }

            return(base.GetToolTipFor(parameterDTO, hi));
        }
 protected override void Context()
 {
     _parameterMapper    = A.Fake <IParameterToParameterDTOMapper>();
     _parameter          = DomainHelperForSpecs.ConstantParameterWithValue(5);
     _parameterDTO       = new ParameterDTO(_parameter);
     _parameterContainer = new ParameterContainerForSpecs();
     A.CallTo(() => _parameterMapper.MapFrom(_parameter)).Returns(_parameterDTO);
     sut     = new ParameterToParameterDTOInContainerMapper <ParameterContainerForSpecs>(_parameterMapper);
     _result = sut.MapFrom(_parameter, _parameterContainer, x => x.ParameterValue, x => x.ParmaeterDTO);
 }
예제 #22
0
        public bool ParameterIsDistributed(IParameterDTO parameterDTO)
        {
            var distributedParameter = ParameterFrom(parameterDTO) as IDistributedParameter;

            if (distributedParameter == null)
            {
                return(false);
            }
            return(distributedParameter.Formula.DistributionType() != DistributionTypes.Discrete);
        }
예제 #23
0
        protected virtual SuperToolTip GetToolTipFor(IParameterDTO parameterDTO, GridHitInfo hi)
        {
            //don't show tooltips for value as it might contain error info that would be hidden
            if (hi.Column == _columnValue.XtraColumn)
            {
                return(null);
            }

            return(_toolTipCreator.ToolTipFor(parameterDTO));
        }
예제 #24
0
        public bool CanEditParameter(IParameterDTO parameterDTO)
        {
            if (parameterDTO.Parameter.Editable)
            {
                return(true);
            }

            //table parameter are always editable
            return(parameterDTO.FormulaType == FormulaType.Table);
        }
예제 #25
0
 private void addValueDescriptionToolTip(SuperToolTip toolTip, IParameterDTO parameterDTO)
 {
     if (string.IsNullOrEmpty(parameterDTO.ValueDescription))
     {
         return;
     }
     toolTip.Items.AddSeparator();
     toolTip.WithTitle(PKSimConstants.UI.ValueDescription);
     toolTip.WithText(parameterDTO.ValueDescription);
 }
예제 #26
0
        private OriginDataParameter originDataParameterFrom(IParameterDTO parameterDTO, bool addName = false)
        {
            var originDataParameter = new OriginDataParameter(parameterDTO.KernelValue, displayUnit(parameterDTO));

            if (addName)
            {
                originDataParameter.Name = parameterDTO.Name;
            }

            return(originDataParameter);
        }
예제 #27
0
 private void configureRepository(BaseEdit baseEdit, IParameterDTO parameterDTO)
 {
     if (molWeightGroupPresenter.IsHalogens(parameterDTO))
     {
         OnEvent(molWeightGroupPresenter.EditHalogens);
     }
     else
     {
         _comboBoxUnit.UpdateUnitsFor(baseEdit, parameterDTO);
     }
 }
예제 #28
0
        private static IBusinessRuleSet rulesFor <TProperty>(IParameterDTO parameterDTO, TProperty displayValue)
        {
            var parameter = parameterDTO.Parameter;

            if (parameter == null)
            {
                return(new BusinessRuleSet());
            }

            return(parameter.Validate(x => x.Value, parameter.ConvertToBaseUnit(displayValue.ConvertedTo <double>())));
        }
예제 #29
0
 public SimulationExpressionsDTO(IParameterDTO referenceConcentration, IParameterDTO halfLifeLiver, IParameterDTO halfLifeIntestine, IReadOnlyList <ExpressionContainerDTO> relativeExpressions)
 {
     ReferenceConcentration = referenceConcentration;
     HalfLifeLiver          = halfLifeLiver;
     HalfLifeIntestine      = halfLifeIntestine;
     RelativeExpressions    = relativeExpressions;
     MoleculeParameters     = new[] { ReferenceConcentration.Parameter, HalfLifeLiver.Parameter, HalfLifeIntestine.Parameter };
     AllParameters          = new List <IParameterDTO>(RelativeExpressions.Select(x => x.RelativeExpressionParameter))
     {
         referenceConcentration, halfLifeLiver, halfLifeIntestine
     };
 }
예제 #30
0
 public bool IsFormulaNotFixed(IParameterDTO parameterDTO)
 {
     if (parameterDTO.Parameter == null)
     {
         return(false);
     }
     if (parameterDTO.FormulaType != FormulaType.Rate)
     {
         return(false);
     }
     return(!parameterDTO.Parameter.IsFixedValue);
 }