public Vesicle(metabolites what, int dist, int amount, Organelle or, Organelle dest) { resource = what; distance = dist; this.amount = amount; origin = or; destination = dest; }
public void IWant(metabolites what, int amount, Organelle org) //requests resources from this organelle (later processed by DispatchResources) { if (amount > 0) { requests += amount; beggars.Add(new WaitingRoom(amount, org, what)); } }
public Path(Organelle start, Organelle end, int x, int y, int xx, int yy, int len) { this.start = start; this.end = end; this.startX = x; startY = y; endX = xx; endY = yy; length = len; intervalX = (xx - x) / length; intervalY = (yy - y) / length; }
public new void IWant(metabolites what, int amount, Organelle org) //requests resources from chloroplast - unlike other organelles there are two types available { if (what == metabolites.O2) { requestsO += amount; beggarsO.Add(new WaitingRoom(amount, org, what)); } if (what == metabolites.glucose) { requestsG += amount; beggarsG.Add(new WaitingRoom(amount, org, what)); } ; }
public new void IWant(metabolites what, int amount, Organelle org) //requests resources from puddle - unlike other organelles there are two types available { if (amount > 0) { if (what == metabolites.P) { requestsP += amount; beggarsP.Add(new WaitingRoom(amount, org, what)); } if (what == metabolites.N) { requestsN += amount; beggarsN.Add(new WaitingRoom(amount, org, what)); } } }
void ProcessCounters(string counters) { string[] lines = counters.Split(';'); foreach (string line in lines) { string[] parts = line.Split('='); List <Position> cntrs = new List <Position>(); Organelle org = GetOrganelleByName(parts[0].Trim()); string[] resources = parts[1].Split('-'); foreach (string resource in resources) { string[] pos = resource.Split(','); cntrs.Add(new Position(GetMetByName(pos[0].Trim()), int.Parse(pos[1]), int.Parse(pos[2]))); } org.SetCounterPos(cntrs); } }
void ProcessPaths(string paths) { //saves paths in the dictionary of the starting organelle string[] lines = paths.Split(';'); foreach (string line in lines) { string[] path = line.Trim().Split(','); Organelle org = GetOrganelleByName(path[0].Trim()); if (dict.ContainsKey(org)) { Organelle end = GetOrganelleByName(path[1].Trim()); dict[org].Add(end, new Path (org, end, int.Parse(path[2]), int.Parse(path[3]), int.Parse(path[4]), int.Parse(path[5]), int.Parse(path[6]))); } else { dict.Add(org, new Dictionary <Organelle, Path>()); Organelle end = GetOrganelleByName(path[1].Trim()); dict[org].Add(end, new Path (org, end, int.Parse(path[2]), int.Parse(path[3]), int.Parse(path[4]), int.Parse(path[5]), int.Parse(path[6]))); } } }
public void SendResources(metabolites what, int amount, int distance, Organelle who) //allows resources to be sent to this organelle in a vesicule { OnTheWay.Add(new Vesicle(what, distance, amount, who, this)); }
public new void IWant(metabolites what, int amount, Organelle org) { //all resources can be requested requests[(int)what] += amount; beggars.Add(new WaitingRoom(amount, org, what)); }
public WaitingRoom(int amount, Organelle org, metabolites what) { this.amount = amount; organelle = org; resource = what; }