Exemple #1
0
        public void SendElementFilter(List <ElementFilterInstruction> ins)
        {
            List <string> toRemoveGene   = new List <string> ();
            List <string> toRemoveRegion = new List <string> ();

            foreach (ElementFilterInstruction ele in ins)
            {
                foreach (KeyValuePair <string, Gene> kvp in Genes)
                {
                    if (ele.ElementType == kvp.Value.RegionTypeName)
                    {
                        if (kvp.Value.Length < ele.MinLength || kvp.Value.Length > ele.MaxLength)
                        {
                            toRemoveGene.Add(kvp.Key);
                        }
                    }
                    else
                    {
                        kvp.Value.RecieveFilterInstruction(ele);
                    }
                }
                foreach (KeyValuePair <string, Region> kvp in Regions)
                {
                    if (kvp.Value.RegionTypeName == ele.ElementType)
                    {
                        if (kvp.Value.Length < ele.MinLength || kvp.Value.Length > ele.MaxLength)
                        {
                            toRemoveRegion.Add(kvp.Key);
                        }
                    }
                    else
                    {
                        kvp.Value.RecieveFilterInstruction(ele);
                    }
                }
            }
            foreach (string st in toRemoveGene)
            {
                Genes.Remove(st);
            }
            foreach (string st in toRemoveRegion)
            {
                Regions.Remove(st);
            }
        }
Exemple #2
0
 /// <summary>
 /// Remove gene from the network with all its dependencies.
 /// </summary>
 public Gene RemoveGene(Gene targetGene)
 {
     targetGene.Disconnect();
     Genes.Remove(targetGene);
     return(targetGene);
 }