예제 #1
0
        private async Task <CompoundProcessesSelection> modelProcessSelectionFrom(CompoundProcessSelection[] snapshotProcesses, Model.Compound compound, ISimulationSubject simulationSubject, SnapshotContext snapshotContext)
        {
            var compoundProcessesSelection = new CompoundProcessesSelection();

            if (snapshotProcesses == null)
            {
                return(compoundProcessesSelection);
            }

            foreach (var snapshotProcess in snapshotProcesses)
            {
                var process = compound.ProcessByName(snapshotProcess.Name) ?? notSelectedProcessFrom(snapshotProcess, simulationSubject);
                if (process == null)
                {
                    //No process found and a name was specified. This is a snapshot that is corrupted
                    if (!string.IsNullOrEmpty(snapshotProcess.Name))
                    {
                        _logger.AddWarning(PKSimConstants.Error.ProcessNotFoundInCompound(snapshotProcess.Name, compound.Name));
                    }

                    continue;
                }

                await addProcessToProcessSelection(compoundProcessesSelection, snapshotProcess, process, snapshotContext);
            }

            return(compoundProcessesSelection);
        }
예제 #2
0
        private async Task <CompoundProcessesSelection> modelProcessSelectionFrom(CompoundProcessSelection[] snapshotProcesses, Model.Compound compound)
        {
            var compoundProcessesSelection = new CompoundProcessesSelection();

            if (snapshotProcesses == null)
            {
                return(compoundProcessesSelection);
            }

            foreach (var snapshotProcess in snapshotProcesses)
            {
                var process = compound.ProcessByName(snapshotProcess.Name);
                if (process == null)
                {
                    _logger.AddWarning(PKSimConstants.Error.ProcessNotFoundInCompound(snapshotProcess.Name, compound.Name));
                }
                else
                {
                    await addProcessToProcessSelection(compoundProcessesSelection, snapshotProcess, process);
                }
            }

            return(compoundProcessesSelection);
        }