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 new int GetAmount(metabolites what) { if (what == metabolites.phospholipids) { return(contents); } else { return(0); } }
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 override void DispatchResources() { foreach (WaitingRoom beggar in beggars) { metabolites type = beggar.GetRes(); double fraction = (double)contents[(int)type] / (double)requests[(int)type]; distances.TryGetValue(beggar.GetOrg(), out int distance); int amount = (int)(beggar.GetAmount() * fraction * 0.7); if (amount > 0) { beggar.GetOrg().SendResources(type, amount, distance, this); contents[(int)type] -= amount; requests[(int)type] -= beggar.GetAmount(); } } beggars = new List <WaitingRoom>(); }
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)); } } }
Color GetColor(metabolites met) { switch ((int)met) { case 0: return(Color.Red); break; case 1: return(Color.LightCoral); break; case 2: return(Color.LightSteelBlue); break; case 3: return(Color.MediumTurquoise); break; case 4: return(Color.Navy); break; case 5: return(Color.Violet); break; case 6: return(Color.Gold); break; case 7: return(Color.OliveDrab); break; } return(Color.Gray); }
//public int GetProduct(int amount, metabolites what) //{ // if (contents[(int)what] >= amount) // { // contents[(int)what] -= amount; // return amount; // } // else // { // int available = contents[(int)what]; // contents[(int)what] = 0; // return available; // } //} public void AddResource(int amount, metabolites what) //adds a resource to the contents array { contents[(int)what] += amount; }
public int GetAmount(metabolites what) { return(contents[(int)what]); }
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 Position(metabolites res, int x, int y) { resource = res; X = x; Y = y; }
public WaitingRoom(int amount, Organelle org, metabolites what) { this.amount = amount; organelle = org; resource = what; }