Beispiel #1
0
        static void Main(string[] args)
        {
            string resultsPath = @"C:\VsProjs\lotalot\ej.csv";

            IMultiLottoManager       managerMain = new MultiLottoManager(resultsPath);
            IMultiLottoManager       specMain    = new FeaturesMultiLottoManager(managerMain);
            IList <IData>            dataSet     = specMain.Data;
            AvlTree <LottoAggregate> tree        = new AvlTree <LottoAggregate>();
            List <LottoAggregate>    aggregates  = new List <LottoAggregate>();

            string[] names = new string[3];
            for (int i = dataSet.Count - 1; i >= 0; i--)
            {
                LottoAggregate aggregate = new LottoAggregate();
                for (int j = 0; j < 3; j++)
                {
                    names[j] = GetName(dataSet, i, j);
                    aggregate.Add(names[j], GetData(dataSet, i, j));
                }
                tree.Insert(aggregate);
                aggregates.Add(aggregate);
                //tree.Print();
            }

            MultiCombination <int> mainModel     = (MultiCombination <int>)managerMain.Spec.CreateModel();
            LottoAggregate         findAggregate = new LottoAggregate();

            findAggregate.Add(names[0], GetIndex(dataSet, aggregates, 0));
            findAggregate.Add(names[1], GetIndex(dataSet, aggregates, 1));
            findAggregate.Add(names[2], GetIndex(dataSet, aggregates, 2));
            //tree.Print();
            var nearAggregate = tree.Find(aggregates[0]);

            Print(nearAggregate.left?.value, mainModel, names[0]);
            Print(nearAggregate.left?.value, mainModel.Main, names[1]);
            Print(nearAggregate.left?.value, mainModel.Sub, names[2]);

            Print(nearAggregate.right?.value, mainModel, names[0]);
            Print(nearAggregate.right?.value, mainModel.Main, names[1]);
            Print(nearAggregate.right?.value, mainModel.Sub, names[2]);

            Print(nearAggregate.parent?.value, mainModel, names[0]);
            Print(nearAggregate.parent?.value, mainModel.Main, names[1]);
            Print(nearAggregate.parent?.value, mainModel.Sub, names[2]);
            Console.Read();
        }
Beispiel #2
0
 private static void Print(LottoAggregate leftValue, ICombination <int> mainModel, string name)
 {
     Console.WriteLine(string.Join(",", mainModel.Element(leftValue.Data[name])));
 }