Beispiel #1
0
        private IDataItem <string[]> getRandomData()
        {
            int row, col;

            row = r.Next(fileData.Length);
            col = r.Next(fileData[0].Length());

            IDataItem <String[]> di = Factory.getObject <IDataItem <string[]> >();

            di.setValue(new string[3]);
            di.getValue()[0] = col.ToString();
            di.getValue()[1] = fileData[row].GetItem(col).getValue();

            return(di);
        }
Beispiel #2
0
        private IDataSet <string[]> getRandomSet()
        {
            IDataSet <string[]> temp = Factory.getObject <IDataSet <string[]> >();

            temp.AddItem(getRandomData());

            IDataItem <string[]> di = Factory.getObject <IDataItem <string[]> >();

            di.setValue(new string[3]);

            di.getValue()[0] = r.Next(1, 4).ToString();

            temp.AddItem(di);

            temp.AddItem(getRandomData());

            if (temp.GetItem(0).getValue() != temp.GetItem(2).getValue())
            {
                return(temp);
            }
            else
            {
                return(getRandomSet());
            }
        }
Beispiel #3
0
        public override IDataSet <string[]> mutate(IDataSet <string[]> child)
        {
            int n = r.Next(0, 3);

            if (n == 1)
            {
                child.GetItem(1).getValue()[0] = r.Next(1, 4).ToString();
            }
            else
            {
                IDataItem <string[]> di = getRandomData();

                if (di.getValue()[0] == child.GetItem(n).getValue()[0])
                {
                    child = mutate(child);
                }
                else
                {
                    child.GetItem(n).setValue(di.getValue());
                }
            }

            return(child);
        }