Ejemplo n.º 1
0
        public WBSolver(IEnumerable <IWBGrid> grids, WBProjectOptions Options)
        {
            State = "initial";
            if (grids != null)
            {
                Grids = new Dictionary <string, IWBGrid>(grids.Count());
                foreach (var gr in grids)
                {
                    var key   = gr.Name;
                    int index = 1;
                    while (Grids.ContainsKey(key))
                    {
                        key = gr.Name + $"{index++}";
                    }
                    Grids.Add(key, gr);
                }
            }

            this.Options = Options;
        }
        public static WBSolver Get(string name, WBProjectOptions options)
        {
            //var tt = generDict.Value;
            //var sss = typeof(SolversFactory)
            //    .GetMethods()
            //    .Where(m => m.GetCustomAttributes(typeof(SolverGeneratorAttribute), false).Length > 0)
            //    .ToList();

            //var m1 = sss[0];
            //var attr = (SolverGeneratorAttribute)m1.GetCustomAttributes(typeof(SolverGeneratorAttribute), false)[0];
            //var f = DelegateBuilder.BuildDelegate<Func<WBProjectOptions, WBSolver>>(m1);
            if (generDict.Value.ContainsKey(name))
            {
                return(generDict.Value[name](options));
            }
            else
            {
                throw new ArgumentException("Нет такого решателя");
            }
        }
Ejemplo n.º 3
0
 public WBSolver(IWBGrid grid, WBProjectOptions Options) : this(new IWBGrid[] { grid }, Options)
 {
 }
Ejemplo n.º 4
0
 public static WBSolver Factory(string solName, WBProjectOptions options)
 {
     return(SolversFactory.Get(solName, options));
 }