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
 public new int GetAmount(metabolites what)
 {
     if (what == metabolites.phospholipids)
     {
         return(contents);
     }
     else
     {
         return(0);
     }
 }
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 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>();
 }
Esempio n. 6
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. 7
0
        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);
        }
Esempio n. 8
0
        //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;
        }
Esempio n. 9
0
 public int GetAmount(metabolites what)
 {
     return(contents[(int)what]);
 }
Esempio n. 10
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. 11
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. 12
0
 public Position(metabolites res, int x, int y)
 {
     resource = res;
     X        = x;
     Y        = y;
 }
Esempio n. 13
0
 public WaitingRoom(int amount, Organelle org, metabolites what)
 {
     this.amount = amount;
     organelle   = org;
     resource    = what;
 }