private string GetMultiCount(string primePattern, IMulitCombination <int> mulitCombination) { string[] splits = primePattern.Split(':'); string mainPattern = string.Join(":", splits.Take(mulitCombination.Main.ChosenElements)); string subPattern = string.Join(":", splits.Skip(mulitCombination.Main.ChosenElements)); return(GetCount(mainPattern, mulitCombination.Main) + ":" + GetCount(subPattern, mulitCombination.Sub)); }
public IEnumerable <IData> CreateDataRows(IDataSet dataSet) { List <IData> rows = new List <IData>(); var headers = dataSet.VariableNames.ToList(); List <DateTime> drawDates = new List <DateTime>(); Dictionary <string, List <int> > balls = new Dictionary <string, List <int> >(); foreach (var header in headers) { if (dataSet.VariableHasType <DateTime>(header)) { drawDates.AddRange(dataSet.GetDateTimeValues(header)); } if (dataSet.VariableHasType <double>(header)) { balls.Add(header, dataSet.GetValues <double>(header).Select(x => (int)x).ToList()); } } for (int i = 0; i < drawDates.Count; i++) { List <int> drawBalls = new List <int>(); var ballKeys = balls.Keys.ToList(); var ballKeyCount = ballKeys.Count; for (var key = 0; key < ballKeyCount; key++) { drawBalls.Add(balls[ballKeys[key]][i]); } if (Config.Model is IMulitCombination <int> ) { IMulitCombination <int> model = (IMulitCombination <int>)Config.Model; List <int> mainBalls = new List <int>(drawBalls.Take(model.Main.ChosenElements)); mainBalls.Sort(); List <int> starBalls = new List <int>(drawBalls.Skip(model.Main.ChosenElements)); starBalls.Sort(); drawBalls = new List <int>(); drawBalls.AddRange(mainBalls); drawBalls.AddRange(starBalls); } else { drawBalls.Sort(); } rows.Add(CreateDraw(drawBalls, Config.Model, drawDates[i])); } return(rows); }