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