public static ComponentBase ComponentFactory(string componentType) { switch(componentType) { case("Flagella"): { FlagellaComponent component= new FlagellaComponent(); component.componentType = componentType; return component; } case("Receptor"): { ReceptorComponent component = new ReceptorComponent(); component.componentType = componentType; return component; } case ("Cell Body"): { CellBodyComponent component = new CellBodyComponent(); component.componentType = componentType; return component; } } return null; }
/// <summary> /// Constructor for creating a cell instance with a cell definition /// </summary> /// <param name="cellDefinition"> /// A <see cref="CellDefinition"/> /// </param> public CellInstance(CellDefinition cellDefinition) { this.cellInstanceDefinition = cellDefinition; SBML.Model model = cellDefinition.getModel(); if (model != null) { this.species = cellDefinition.getModel().listOfSpecies; } // Initialize the specials Dictionary this.speciesVariables = new Dictionary<string, double>(); this.localSpeciesVariables = new Dictionary<string, double>(); this.localSpeciesDelta = new Dictionary<string, double>(); this.speciesToIndexMap = new Dictionary<string, int>(); this.indexToSpeciesMap = new Dictionary<int, string>(); // set up the list this.convertSpeciesListToVariables(); this.components = new List<MuCell.Model.SBML.ExtracellularComponents.ComponentWorldStateBase>(); this.flaggy = new MuCell.Model.SBML.ExtracellularComponents.FlagellaComponent(); cellInstanceSpatialContext = new SpatialContext(); }