public bool QuantityIsSelectable(IQuantity quantity, bool forceAmountToBeSelectable)
        {
            if (quantity.IsAnImplementationOf <IObserver>())
            {
                return(true);
            }

            if (quantity.IsAnImplementationOf <IMoleculeAmount>() && forceAmountToBeSelectable)
            {
                return(true);
            }

            if (isMoleculeAmountInAmountBasedProject(quantity))
            {
                return(true);
            }

            if (isMoleculeConcentrationInConcentrationBasedProject(quantity))
            {
                return(true);
            }

            if (isPersistableParameter(quantity))
            {
                return(true);
            }

            return(false);
        }
 private bool isMoleculeConcentrationInConcentrationBasedProject(IQuantity quantity)
 {
     return(quantity.IsAnImplementationOf <IParameter>() &&
            _reactionDimensionRetriever.SelectedDimensionMode == ReactionDimensionMode.ConcentrationBased &&
            quantity.IsNamed(Constants.Parameters.CONCENTRATION) &&
            quantity.ParentContainer.IsAnImplementationOf <IMoleculeAmount>());
 }
Example #3
0
        private void adjustDisplayPathForQuantity(PathElements pathElements, IQuantity quantity)
        {
            if (quantity.HasAncestorNamed(CoreConstants.Organ.Gallbladder))
            {
                adjustDisplayPathForGallBladder(pathElements, quantity);
            }

            else if (quantity.HasAncestorNamed(CoreConstants.Organ.Lumen))
            {
                adjustDisplayPathForLumen(pathElements, quantity);
            }

            else if (quantity.IsNamed(PLASMA_UNBOUND))
            {
                adjustDisplayPathForContainerObserver(pathElements, quantity);
            }

            else if (!pathElements.Contains(PathElement.BottomCompartment))
            {
                adjustDisplayPathForContainerObserver(pathElements, quantity);
            }

            else if (quantity.IsAnImplementationOf <IObserver>())
            {
                adjustDisplayNameForMoleculeObserver(pathElements, quantity.DowncastTo <IObserver>());
            }
        }
Example #4
0
        private void adjustDisplayPathForQuantity(PathElements pathElements, IQuantity quantity)
        {
            if (quantity.HasAncestorNamed(CoreConstants.Organ.GALLBLADDER))
            {
                adjustDisplayPathForGallBladder(pathElements, quantity);
            }

            else if (quantity.HasAncestorNamed(CoreConstants.Organ.LUMEN))
            {
                adjustDisplayPathForLumen(pathElements, quantity);
            }

            else if (quantity.IsNamed(CoreConstants.Observer.PLASMA_UNBOUND))
            {
                adjustDisplayPathForContainerObserver(pathElements, quantity);
            }

            else if (quantity.Name.StartsWith(CoreConstants.Observer.TOTAL_FRACTION_OF_DOSE))
            {
                adjustDisplayPathForTotalFractionOfDose(pathElements, quantity);
            }

            //Container observers directly in a container located under organism
            else if (!pathElements.Contains(PathElementId.BottomCompartment))
            {
                adjustDisplayPathForContainerObserver(pathElements, quantity);
            }

            else if (quantity.IsAnImplementationOf <IObserver>())
            {
                adjustDisplayNameForMoleculeObserver(pathElements, quantity.DowncastTo <IObserver>());
            }
        }
Example #5
0
        public ICommand SetQuantityDimension(IQuantity quantity, IDimension dimension, IBuildingBlock buildingBlock)
        {
            if (quantity.IsAnImplementationOf <IDistributedParameter>())
            {
                return(SetDistributedParameterDimension(quantity.DowncastTo <IDistributedParameter>(), dimension, buildingBlock));
            }

            return(new SetQuantityDimensionCommand(quantity, dimension, buildingBlock).Run(_context));
        }
        private bool isParameterStartValue(IQuantity changedQuantity, IMoBiBuildConfiguration buildConfiguration)
        {
            if (!changedQuantity.IsAnImplementationOf <IParameter>())
            {
                return(false);
            }

            var parameterStartValues = buildConfiguration.ParameterStartValues;
            var path = _entityPathResolver.ObjectPathFor(changedQuantity);

            return(parameterStartValues.Any(psv => Equals(psv.Path, path)));
        }
 private bool isMoleculeAmountInAmountBasedProject(IQuantity quantity)
 {
     return(quantity.IsAnImplementationOf <IMoleculeAmount>() &&
            _reactionDimensionRetriever.SelectedDimensionMode == ReactionDimensionMode.AmountBased);
 }
 private bool isPersistableParameter(IQuantity quantity)
 {
     return(quantity.IsAnImplementationOf <IParameter>() && quantity.Persistable);
 }
 private bool isMoleculeStartValue(IQuantity changedQuantity, IMoBiBuildConfiguration buildConfiguration)
 {
     return(changedQuantity.IsAnImplementationOf <IMoleculeAmount>() ||
            (changedQuantity.ParentContainer.IsAnImplementationOf <IMoleculeAmount>() && changedQuantity.IsNamed(Constants.Parameters.START_VALUE)));
 }
 private bool isObserver(IQuantity changedQuantity, IMoBiBuildConfiguration buildConfiguration)
 {
     return(changedQuantity.IsAnImplementationOf <IObserver>());
 }