Exemple #1
0
        private ICommand <IMoBiContext> updateSimulation(
            IMoBiSimulation simulationToUpdate,
            IMoBiBuildConfiguration buildConfigurationReferencingTemplates,
            IMoBiCommand configurationCommands,
            IBuildingBlock templateBuildingBlock       = null,
            PathCache <IQuantity> fixedValueQuantities = null)
        {
            //create model using referencing templates
            var model = createModelAndValidate(simulationToUpdate.Model.Name, buildConfigurationReferencingTemplates);

            var simulationBuildConfiguration = createBuildConfigurationToUseInSimulation(buildConfigurationReferencingTemplates);

            var updateSimulationCommand = templateBuildingBlock == null
            ? // is null when we a simulation is being configured. Otherwise this is the template building block to user
                                          new UpdateSimulationCommand(simulationToUpdate, model, simulationBuildConfiguration)
            : new UpdateSimulationCommand(simulationToUpdate, model, simulationBuildConfiguration, templateBuildingBlock);

            updateSimulationCommand.Run(_context);

            synchronizeFixedParameterValues(simulationToUpdate, templateBuildingBlock, fixedValueQuantities);

            var macro = new MoBiMacroCommand
            {
                Description = updateSimulationCommand.Description,
                CommandType = updateSimulationCommand.CommandType,
                ObjectType  = updateSimulationCommand.ObjectType
            };

            macro.Add(configurationCommands);
            macro.Add(updateSimulationCommand);
            return(macro);
        }
        public virtual IMoBiCommand CreateCommitToBuildingBlockCommand(IMoBiSimulation simulation, IBuildingBlock templateBuildingBlock)
        {
            var macroCommand = new MoBiMacroCommand();

            macroCommand.Add(CreateCommitCommand(simulation, templateBuildingBlock));
            //hide this command that is only required for separation of concerns
            macroCommand.Add(new ResetFixedConstantParametersToDefaultInSimulationCommand <T>(simulation, _buildingBlockRetriever(simulation.BuildConfiguration))
            {
                Visible = false
            });
            return(macroCommand);
        }
        public override IMoBiCommand CreateCommitToBuildingBlockCommand(IMoBiSimulation simulation, IBuildingBlock templateBuildingBlock)
        {
            var macroCommand = new MoBiMacroCommand();

            macroCommand.Add(CreateCommitCommand(simulation, templateBuildingBlock));
            //hide this command that is only required for separation of concerns
            macroCommand.Add(new ResetMoleculeValuesToDefaultFromStartValuesInSimulationCommand(simulation)
            {
                Visible = false
            });
            return(macroCommand);
        }
Exemple #4
0
        private MoBiMacroCommand getMoveCommands(IMoBiReactionBuildingBlock sourceBuildingBlock, IMoBiReactionBuildingBlock targetBuildingBlock, IReactionBuilder builder, string builderOriginalName)
        {
            var macroCommand = new MoBiMacroCommand();

            macroCommand.Add(getMoveCommand(sourceBuildingBlock, targetBuildingBlock, builder.Name, builderOriginalName));


            builder.Educts.Each(educt => macroCommand.Add(movePartnersCommand(sourceBuildingBlock, targetBuildingBlock, educt)));
            builder.Products.Each(product => macroCommand.Add(movePartnersCommand(sourceBuildingBlock, targetBuildingBlock, product)));
            builder.ModifierNames.Each(modifier => macroCommand.Add(movePartnerNamed(sourceBuildingBlock, targetBuildingBlock, modifier)));
            return(macroCommand);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        private IMoBiCommand withUpdatedDefaultStateAndValueOrigin(IMoBiCommand executedCommand, IFormula formula, IBuildingBlock buildingBlock)
        {
            if (executedCommand.IsEmpty())
            {
                return(executedCommand);
            }

            var parametersUsingFormula = _parameterInBuildingBlockRetriever.AllFrom(buildingBlock, p => Equals(p.Formula, formula));

            if (!parametersUsingFormula.Any())
            {
                return(executedCommand);
            }

            var updateValueOriginCommand = new MoBiMacroCommand();

            parametersUsingFormula.Each(p => updateValueOriginCommand.Add(_quantityTask.UpdateDefaultStateAndValueOriginFor(p, buildingBlock)));

            //we have depending parameters but they all have default state and value origin set;
            if (updateValueOriginCommand.IsEmtpy)
            {
                return(executedCommand);
            }

            var macroCommand = new MoBiMacroCommand().WithHistoryEntriesFrom(executedCommand);

            macroCommand.Add(executedCommand);
            macroCommand.AddRange(updateValueOriginCommand.All());
            return(macroCommand);
        }
Exemple #7
0
        public override IMoBiCommand AddNew(IMoBiProject project, IBuildingBlock buildingBlockToAddTo)
        {
            if (!project.MoleculeBlockCollection.Any() || !project.SpatialStructureCollection.Any())
            {
                throw new MoBiException(AppConstants.Exceptions.UnableToCreateStartValues);
            }

            TBuildingBlock newEntity;

            using (var createPresenter = ApplicationController.Start <ICreateStartValuesPresenter <TBuildingBlock> >())
            {
                newEntity = createPresenter.Create();
            }

            if (newEntity == null)
            {
                return(new MoBiEmptyCommand());
            }

            var macroCommand = new MoBiMacroCommand
            {
                ObjectType  = ObjectName,
                CommandType = AppConstants.Commands.AddCommand
            };

            macroCommand.Add(GetAddCommand(newEntity, project, buildingBlockToAddTo).Run(Context));

            //Icon may depend on name.
            newEntity.Icon           = InteractionTask.IconFor(newEntity);
            macroCommand.Description = AppConstants.Commands.AddToProjectDescription(ObjectName, newEntity.Name);
            _editTask.EditBuildingBlock(newEntity);
            return(macroCommand);
        }
Exemple #8
0
        public IMoBiCommand SetValue(TBuildingBlock buildingBlock, double?valueInDisplayUnit, TStartValue startValue)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                ObjectType  = _interactionTaskContext.GetTypeFor <TStartValue>(),
                Description = AppConstants.Commands.SetStartValueAndFormula
            };

            macroCommand.Add(setValue(startValue, valueInDisplayUnit, startValue.DisplayUnit, buildingBlock));
            if (startValue.Formula != null)
            {
                macroCommand.Add(setFormula(buildingBlock, startValue, null));
            }
            return(macroCommand);
        }
Exemple #9
0
        protected override ICommand <IMoBiContext> GetInverseCommand(IMoBiContext context)
        {
            var command = new MoBiMacroCommand()
            {
                ObjectType  = ObjectType,
                CommandType = AppConstants.Commands.AddCommand,
                Description = AppConstants.Commands.AddToDescription(ObjectType, _itemToRemove.Name, _parent.Name)
            }.AsInverseFor(this);

            command.Add(new AddContainerToSpatialStructureCommand(_parent, _itemToRemove, _spatialStructure));
            foreach (var neighborhood in _removedNeighborhoods)
            {
                command.Add(new AddContainerToSpatialStructureCommand(_spatialStructure.NeighborhoodsContainer,
                                                                      neighborhood, _spatialStructure));
            }
            return(command);
        }
Exemple #10
0
        public override IMoBiCommand RefreshStartValuesFromBuildingBlocks(IMoleculeStartValuesBuildingBlock buildingBlock, IEnumerable <IMoleculeStartValue> startValuesToRefresh)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                Description = AppConstants.Commands.RefreshStartValuesFromBuildingBlocks,
                ObjectType  = ObjectTypes.MoleculeStartValue
            };

            startValuesToRefresh.Each(startValue =>
            {
                var moleculeBuilder = _moleculeResolver.Resolve(startValue.ContainerPath, startValue.MoleculeName, SpatialStructureReferencedBy(buildingBlock), MoleculeBuildingBlockReferencedBy(buildingBlock));
                if (moleculeBuilder == null)
                {
                    return;
                }

                var originalStartValue = moleculeBuilder.GetDefaultMoleculeStartValue();
                var originalUnit       = moleculeBuilder.DisplayUnit;

                if (!ValueComparer.AreValuesEqual(Constants.DEFAULT_SCALE_DIVISOR, startValue.ScaleDivisor))
                {
                    macroCommand.Add(UpdateStartValueScaleDivisor(buildingBlock, startValue, Constants.DEFAULT_SCALE_DIVISOR, startValue.ScaleDivisor));
                }

                if (!HasEquivalentDimension(startValue, moleculeBuilder))
                {
                    macroCommand.Add(UpdateStartValueDimension(buildingBlock, startValue, moleculeBuilder.Dimension));
                }

                if (!HasEquivalentStartValue(startValue, originalStartValue))
                {
                    macroCommand.Add(SetStartValueWithUnit(startValue, originalStartValue, originalUnit, buildingBlock));
                }

                if (!HasEquivalentFormula(startValue, moleculeBuilder.DefaultStartFormula))
                {
                    macroCommand.Add(ChangeStartValueFormulaCommand(buildingBlock, startValue,
                                                                    moleculeBuilder.DefaultStartFormula.IsConstant() ? null : _cloneManagerForBuildingBlock.Clone(moleculeBuilder.DefaultStartFormula, buildingBlock.FormulaCache)));
                }
            });

            return(macroCommand);
        }
Exemple #11
0
        private ICommand synchronizedCommand(IQuantity quantity, IMoBiSimulation simulation, IMoBiCommand simulationCommandToBeRun, bool shouldUpdateValueOriginAndState = true)
        {
            var macroCommand = new MoBiMacroCommand();

            //add one before setting the value in the simulation to enable correct undo
            macroCommand.Add(_quantitySynchronizer.Synchronize(quantity, simulation));

            IOSPSuiteCommand executedCommand = simulationCommandToBeRun.AsHidden().Run(_context);

            if (shouldUpdateValueOriginAndState)
            {
                executedCommand = withUpdatedDefaultStateAndValueOrigin(executedCommand, quantity, simulation);
            }

            macroCommand.Add(executedCommand);

            macroCommand.Add(_quantitySynchronizer.Synchronize(quantity, simulation));

            //needs to be done at the end because description might be set only after run
            return(macroCommand.WithHistoryEntriesFrom(simulationCommandToBeRun));
        }
Exemple #12
0
        public void Visit(IMoBiSimulation simulation)
        {
            var command = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.AddCommand,
                ObjectType  = ObjectTypes.Simulation,
                Description = AppConstants.Commands.AddToProjectDescription(ObjectTypes.Simulation, simulation.Name)
            };

            command.Add(_simulationLoader.AddSimulationToProject(simulation));
            addCommand(command);
        }
Exemple #13
0
        private void addUpdateDefaultStateAndValueOriginCommand <T>(
            MoBiMacroCommand macroCommand,
            IQuantity quantity,
            T buildingBlockOrSimulation,
            Func <IParameter, bool, T, ICommand> setParameterDefaultStateFunc,
            Func <IParameter, ValueOrigin, T, ICommand> setParameterValueOriginFunc)
        {
            var parameter = quantity as IParameter;

            if (parameter == null || !parameter.IsDefault)
            {
                return;
            }

            var setParameterDefaultStateCommand = setParameterDefaultStateFunc(parameter, false, buildingBlockOrSimulation).AsHidden();

            macroCommand.Add(setParameterDefaultStateCommand);

            var setValueOriginCommand = setParameterValueOriginFunc(parameter, ValueOrigin.Unknown, buildingBlockOrSimulation).AsHidden();

            macroCommand.Add(setValueOriginCommand);
        }
Exemple #14
0
        public override IMoBiCommand RefreshStartValuesFromBuildingBlocks(IParameterStartValuesBuildingBlock buildingBlock, IEnumerable <IParameterStartValue> startValuesToRefresh)
        {
            var spatialStructure      = SpatialStructureReferencedBy(buildingBlock);
            var moleculeBuildingBlock = MoleculeBuildingBlockReferencedBy(buildingBlock);

            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                Description = AppConstants.Commands.RefreshStartValuesFromBuildingBlocks,
                ObjectType  = ObjectTypes.ParameterStartValue
            };

            startValuesToRefresh.Each(startValue =>
            {
                var parameter = _parameterResolver.Resolve(startValue.ContainerPath, startValue.Name, spatialStructure, moleculeBuildingBlock);
                if (parameter == null)
                {
                    return;
                }

                if (!HasEquivalentDimension(startValue, parameter))
                {
                    macroCommand.Add(UpdateStartValueDimension(buildingBlock, startValue, parameter.Dimension));
                }

                if (!HasEquivalentStartValue(startValue, parameter.Value))
                {
                    macroCommand.Add(SetStartDisplayValueWithUnit(startValue, parameter.ConvertToDisplayUnit(parameter.Value), parameter.DisplayUnit, buildingBlock));
                }

                // Evaluating the startValue before the formula is important if the startValue is a constant and the original building block uses a constantformula
                if (!HasEquivalentFormula(startValue, parameter.Formula))
                {
                    macroCommand.Add(ChangeStartValueFormulaCommand(buildingBlock, startValue, parameter.Formula.IsConstant() ? null : _cloneManagerForBuildingBlock.Clone(parameter.Formula, buildingBlock.FormulaCache)));
                }
            });

            return(macroCommand);
        }
Exemple #15
0
        public ICommand <IMoBiContext> AddNewFormulaAtMoleculeStartValueBuildingBlock <T>(IMoleculeStartValuesBuildingBlock buildingBlock, IMoleculeStartValue moleculeStartValue)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                ObjectType  = _interactionTaskContext.GetTypeFor(moleculeStartValue),
                Description = AppConstants.Commands.SetStartValueAndFormula
            };

            macroCommand.Add(AddFormulaToFormulaCacheAndSetOnStartValue <ExplicitFormula>(buildingBlock, moleculeStartValue, referenceParameter: null));

            return(macroCommand);
        }
Exemple #16
0
        public IMoBiCommand UpdateFormula(IEntity usingFormula, IFormula oldFormula, IFormula newFormula, FormulaDecoder formulaDecoder, IBuildingBlock buildingBlock)
        {
            var command  = new EditObjectBasePropertyInBuildingBlockCommand(formulaDecoder.PropertyName, newFormula, oldFormula, usingFormula, buildingBlock).Run(_context);
            var quantity = usingFormula as IQuantity;

            if (quantity == null)
            {
                return(command);
            }

            var updateCommand = _quantityTask.UpdateDefaultStateAndValueOriginFor(quantity, buildingBlock);

            if (updateCommand.IsEmpty() || updateCommand.IsEmptyMacro())
            {
                return(command);
            }

            var macroCommand = new MoBiMacroCommand().WithHistoryEntriesFrom(command);

            macroCommand.Add(command);
            macroCommand.Add(updateCommand);
            return(macroCommand);
        }
Exemple #17
0
        public IMoBiCommand SetIsPresent(IMoleculeStartValuesBuildingBlock moleculeStartValues, IEnumerable <IMoleculeStartValue> startValues, bool isPresent)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                Description = AppConstants.Commands.SettingIsPresentCommandDescription(isPresent),
                ObjectType  = ObjectTypes.MoleculeStartValue,
            };

            startValues.Where(x => x.IsPresent != isPresent).Each(msv =>
                                                                  macroCommand.Add(updateIsPresent(moleculeStartValues, msv, isPresent)));

            return(macroCommand);
        }
Exemple #18
0
        public ICommand <IMoBiContext> AddNewFormulaAtParameterStartValueBuildingBlock <T>(IParameterStartValuesBuildingBlock buildingBlock, IParameterStartValue parameterStartValue)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                ObjectType  = _interactionTaskContext.GetTypeFor(parameterStartValue),
                Description = AppConstants.Commands.SetStartValueAndFormula
            };

            var parameter = GetpossibleParameterFromProject(parameterStartValue.Path);

            macroCommand.Add(AddFormulaToFormulaCacheAndSetOnStartValue <ExplicitFormula>(buildingBlock, parameterStartValue, parameter));

            return(macroCommand);
        }
Exemple #19
0
        private static MoBiMacroCommand deleteAllResultsFromSimulationCommand(IMoBiSimulation simulation)
        {
            var macoCommand = new MoBiMacroCommand
            {
                CommandType = Command.CommandTypeDelete,
                ObjectType  = ObjectTypes.ObservedData,
                Description = AppConstants.Commands.DeleteResultsFromSimulation(simulation.Name),
            };

            if (simulation.Results != null)
            {
                macoCommand.AddCommand(new ClearResultsCommand(simulation));
            }

            simulation.HistoricResults.Each(x => macoCommand.Add(new RemoveHistoricResultFromSimulationCommand(simulation, x)));
            return(macoCommand);
        }
        private void addMoleculeNode(string moleculeName, MoBiMacroCommand command)
        {
            if (moleculeName.Equals(String.Empty))
            {
                return;
            }

            var moleculeNodes = reactionDiagramManager.GetMoleculeNodes(moleculeName);

            var message = AppConstants.Diagram.MoleculeNodeAlreadyExistsForMolecule(moleculeName);

            if (moleculeNodes.Any() && (_dialogCreator.MessageBoxYesNo(message) == ViewResult.No))
            {
                return;
            }

            command.Add(new AddMoleculeToReactionBuildingBlockCommand(_model, moleculeName));
        }
        public void RemoveResultsFromSimulations(IReadOnlyList <DataRepository> resultsToRemove)
        {
            if (_dialogCreator.MessageBoxYesNo(AppConstants.Dialog.RemoveSelectedResultsFromSimulations) != ViewResult.Yes)
            {
                return;
            }

            var macroCommand = new MoBiMacroCommand
            {
                Description = AppConstants.Commands.RemoveMultipleResultsFromSimulations,
                ObjectType  = AppConstants.MoBiObjectTypes.Data,
                CommandType = AppConstants.Commands.DeleteCommand
            };

            resultsToRemove.Each(result => { macroCommand.Add(removeResultFromSimulationCommand(result)); });

            _context.AddToHistory(macroCommand.Run(_context));
        }
        public IMoBiCommand MergeBuildingBlocks(IList <IBuildingBlock> buildingBlocksToMerge, IList <IBuildingBlock> targetBuildingBlocks, CancellationToken cancellationToken)
        {
            if (buildingBlocksToMerge.Count != targetBuildingBlocks.Count)
            {
                throw new ArgumentException(AppConstants.Exceptions.MergeBuildingBlocksCountError);
            }
            var mergeCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.MergeCommand,
                ObjectType  = ObjectTypes.Project
            };

            for (var i = 0; i < buildingBlocksToMerge.Count; i++)
            {
                cancellationToken.ThrowIfCancellationRequested();
                mergeCommand.Add(MergeBuildingBlock(buildingBlocksToMerge[i], targetBuildingBlocks[i]));
            }
            return(mergeCommand);
        }
Exemple #23
0
        protected IMoBiCommand AddFormulaToFormulaCacheAndSetOnStartValue <TFormula>(TBuildingBlock startValuesBuildingBlock, TStartValue startValue, IParameter referenceParameter)
            where TFormula : IFormula
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.AddCommand,
                Description = AppConstants.Commands.AddFormulaToBuildingBlock,
                ObjectType  = _interactionTaskContext.GetTypeFor <TFormula>()
            };

            var newFormula = _moBiFormulaTask.CreateNewFormula <TFormula>(startValue.Dimension);

            macroCommand.AddCommand(new AddFormulaToFormulaCacheCommand(startValuesBuildingBlock, newFormula).Run(Context));

            if (!_moBiFormulaTask.EditNewFormula(newFormula, macroCommand, startValuesBuildingBlock, referenceParameter))
            {
                return(CancelCommand(macroCommand));
            }

            macroCommand.Add(SetFormula(startValuesBuildingBlock, startValue, newFormula));
            return(macroCommand);
        }
        public override IMoBiCommand AddExisting(TParent parent, IBuildingBlock buildingBlockWithFormulaCache)
        {
            string filename = InteractionTask.AskForFileToOpen(AppConstants.Dialog.Load(_editTask.ObjectName), Constants.Filter.PKML_FILE_FILTER, Constants.DirectoryKey.MODEL_PART);

            if (filename.IsNullOrEmpty())
            {
                return(new MoBiEmptyCommand());
            }

            var sourceSpatialStructure = InteractionTask.LoadItems <IMoBiSpatialStructure>(filename).FirstOrDefault();

            if (sourceSpatialStructure == null)
            {
                return(new MoBiEmptyCommand());
            }

            var allAvailableContainersToImport = sourceSpatialStructure.TopContainers
                                                 .SelectMany(x => x.GetAllContainersAndSelf <IContainer>(cont => !cont.IsAnImplementationOf <IParameter>()));

            var allImportedContainers    = selectContainersToImport(allAvailableContainersToImport).ToList();
            var allImportedNeighborhoods = getConnectingNeighborhoods(allImportedContainers, sourceSpatialStructure);

            allImportedContainers.Each(registerLoadedIn);
            allImportedNeighborhoods.Each(registerLoadedIn);

            var targetSpatialStructure = GetSpatialStructure();

            var command = AddItemsToProject(allImportedContainers, parent, buildingBlockWithFormulaCache);

            if (command.IsEmpty())
            {
                return(new MoBiEmptyCommand());
            }


            var addNeighborhoodsCommand = addNeighborhoodsToProject(allImportedNeighborhoods, targetSpatialStructure);

            if (addNeighborhoodsCommand.IsEmpty())
            {
                return(command);
            }

            var macroCommand = new MoBiMacroCommand()
            {
                CommandType = command.CommandType, ObjectType = command.ObjectType, Comment = command.Comment, Description = command.Description, ExtendedDescription = command.ExtendedDescription
            };

            macroCommand.Add(command);
            macroCommand.Add(addNeighborhoodsCommand);

            if (sourceSpatialStructure.DiagramModel == null || targetSpatialStructure.DiagramModel == null)
            {
                return(macroCommand);
            }
            var lcs = new LayoutCopyService();

            foreach (var container in allImportedContainers)
            {
                var sourceContainer = sourceSpatialStructure.DiagramModel.GetNode <IContainerNode>(container.Id);
                var targetContainer = targetSpatialStructure.DiagramModel.GetNode <IContainerNode>(container.Id);
                try
                {
                    targetSpatialStructure.DiagramModel.BeginUpdate();
                    lcs.Copy(sourceContainer, targetContainer);
                }
                finally
                {
                    targetSpatialStructure.DiagramModel.EndUpdate();
                }
            }
            if (targetSpatialStructure.DiagramManager.IsInitialized)
            {
                targetSpatialStructure.DiagramManager.RefreshFromDiagramOptions();
            }

            return(macroCommand);
        }
Exemple #25
0
        public IMoBiCommand SetNegativeValuesAllowed(IMoleculeStartValuesBuildingBlock moleculeStartValues, IEnumerable <IMoleculeStartValue> startValues, bool negativeValuesAllowed)
        {
            var macroCommand = new MoBiMacroCommand
            {
                CommandType = AppConstants.Commands.EditCommand,
                Description = AppConstants.Commands.SettingNegativeValuesAllowedCommandDescription(negativeValuesAllowed),
                ObjectType  = ObjectTypes.MoleculeStartValue,
            };

            startValues.Where(x => x.NegativeValuesAllowed != negativeValuesAllowed).Each(msv =>
                                                                                          macroCommand.Add(updateNegativeValuesAllowed(moleculeStartValues, msv, negativeValuesAllowed)));

            return(macroCommand);
        }
Exemple #26
0
 private void prepareMergeActions(TBuildingBlock targetBuildingBlock, MoBiMacroCommand macro)
 {
     _startValueBuildingBlockMergeManager.AddAction    = startValueToMerge => macro.Add(GenerateAddCommandAndUpdateFormulaReferences(startValueToMerge, targetBuildingBlock));
     _startValueBuildingBlockMergeManager.RemoveAction = startValueToMerge => macro.Add(GenerateRemoveCommand(targetBuildingBlock, startValueToMerge));
     _startValueBuildingBlockMergeManager.CancelAction = macro.Clear;
 }