private bool negativeValuesAllowed(string modelName, int containerId, string moleculeName) { var key = new ModelContainerMoleculeKey(modelName, containerId, moleculeName); // if no entry found, return false if (!_mcmProperties.Contains(key)) { return(false); } return(_mcmProperties[key].NegativeValuesAllowed); }
public bool IsPresent(string modelName, int containerId, string moleculeName) { Start(); var key = new ModelContainerMoleculeKey(modelName, containerId, moleculeName); // if no entry found, return true for DRUG and false for all other molecules if (!_mcmProperties.Contains(key)) { return(moleculeName.Equals(CoreConstants.Molecule.Drug)); } return(_mcmProperties[key].IsPresent); }
protected override void DoStart() { // first, cache all (static) molecules used in model (besides DRUG) foreach (var flatModel in _flatModelRepo.All()) { var modelName = flatModel.Id; var molecules = (from mcm in _flatModelContainerMoleculeRepo.All() where mcm.Model.Equals(modelName) where mcm.IsPresent where !mcm.Molecule.Equals(CoreConstants.Molecule.Drug) select mcm.Molecule).Distinct().ToList(); _moleculesForModel.Add(modelName, molecules); } // second, cache MCM-info by {Model, Container, Molecule} foreach (var flatMCM in _flatModelContainerMoleculeRepo.All()) { var key = new ModelContainerMoleculeKey(flatMCM.Model, flatMCM.Id, flatMCM.Molecule); _mcmProperties.Add(key, flatMCM); } }