コード例 #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;
 }
コード例 #2
0
ファイル: Organelle.cs プロジェクト: kvetab/Cell
 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));
     }
 }
コード例 #3
0
ファイル: Path.cs プロジェクト: 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;
 }
コード例 #4
0
ファイル: Chloroplast.cs プロジェクト: kvetab/Cell
 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));
     }
     ;
 }
コード例 #5
0
ファイル: Puddle.cs プロジェクト: kvetab/Cell
 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));
         }
     }
 }
コード例 #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);
     }
 }
コード例 #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])));
         }
     }
 }
コード例 #8
0
ファイル: Organelle.cs プロジェクト: kvetab/Cell
 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));
 }
コード例 #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));
 }
コード例 #10
0
 public WaitingRoom(int amount, Organelle org, metabolites what)
 {
     this.amount = amount;
     organelle   = org;
     resource    = what;
 }