Esempio n. 1
0
 public Vesicle(metabolites what, int dist, int amount, Organelle or, Organelle dest)
 {
     resource    = what;
     distance    = dist;
     this.amount = amount;
     origin      = or;
     destination = dest;
 }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
File: Path.cs Progetto: kvetab/Cell
 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;
 }
Esempio n. 4
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));
     }
     ;
 }
Esempio n. 5
0
 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));
         }
     }
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 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])));
         }
     }
 }
Esempio n. 8
0
 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));
 }
Esempio n. 9
0
 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));
 }
Esempio n. 10
0
 public WaitingRoom(int amount, Organelle org, metabolites what)
 {
     this.amount = amount;
     organelle   = org;
     resource    = what;
 }