Esempio n. 1
0
 public GeneDescriptor[] ImportType()
 {
     GeneDescriptor[] geneDescriptors;
     FieldInfo[] fields;
     fields = type.GetFields( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
     geneDescriptors = new GeneDescriptor[fields.Length];
     int i=0;
     foreach(FieldInfo field in fields)
     {
         System.Type fieldType = field.FieldType;
         switch(fieldType.ToString())
         {
             case "System.Int32":
                 geneDescriptors[i] = new IntegerGeneDescriptor(0, 1000);                        
                 geneDescriptors[i].Name = field.Name;
                 break;
             case "System.Double":
                 geneDescriptors[i] = new DoubleGeneDescriptor();
                 geneDescriptors[i].Name = field.Name;
                 break;
         }   
         System.Diagnostics.Debug.WriteLine(field.ToString() + ": " + field.FieldType.ToString());
         i++;
     }
     return geneDescriptors;
 }
Esempio n. 2
0
        public GeneDescriptor[] ImportType()
        {
            GeneDescriptor[] geneDescriptors;
            FieldInfo[]      fields;
            fields          = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            geneDescriptors = new GeneDescriptor[fields.Length];
            int i = 0;

            foreach (FieldInfo field in fields)
            {
                System.Type fieldType = field.FieldType;
                switch (fieldType.ToString())
                {
                case "System.Int32":
                    geneDescriptors[i]      = new IntegerGeneDescriptor(0, 1000);
                    geneDescriptors[i].Name = field.Name;
                    break;

                case "System.Double":
                    geneDescriptors[i]      = new DoubleGeneDescriptor();
                    geneDescriptors[i].Name = field.Name;
                    break;
                }
                System.Diagnostics.Debug.WriteLine(field.ToString() + ": " + field.FieldType.ToString());
                i++;
            }
            return(geneDescriptors);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates an IntegerGene with the specified constraints and an initial value.
 /// </summary>
 public DoubleGene(DoubleGeneDescriptor descriptor, int value) : base(descriptor)
 {
     this.Descriptor = descriptor;
     this.Value = value;
 }
Esempio n. 4
0
 /// <summary>
 /// Creates an IntegerGene with the specified constraints.
 /// </summary>
 public DoubleGene(DoubleGeneDescriptor descriptor) : base(descriptor)
 {            
     this.Descriptor = descriptor;            
 }
Esempio n. 5
0
 /// <summary>
 /// Creates an IntegerGene with the specified constraints and an initial value.
 /// </summary>
 public DoubleGene(DoubleGeneDescriptor descriptor, int value) : base(descriptor)
 {
     this.Descriptor = descriptor;
     this.Value      = value;
 }
Esempio n. 6
0
 /// <summary>
 /// Creates an IntegerGene with the specified constraints.
 /// </summary>
 public DoubleGene(DoubleGeneDescriptor descriptor) : base(descriptor)
 {
     this.Descriptor = descriptor;
 }