Ejemplo n.º 1
0
        public ISearchStrategy CreateInstance(
            AST <Node> module,
            string collectionName,
            string instanceName)
        {
            var inst = new OATStrategy();

            inst.Module         = module;
            inst.CollectionName = collectionName;
            inst.InstanceName   = instanceName;
            return(inst);
        }
Ejemplo n.º 2
0
        public ISearchStrategy Begin(ISolver solver, out List <Flag> flags)
        {
            var inst = new OATStrategy();

            inst.solver         = solver;
            inst.Module         = Module;
            inst.CollectionName = CollectionName;
            inst.InstanceName   = InstanceName;
            inst.Table          = solver.SymbolTable;

            flags = new List <Flag>();
            Cnst   cnstVal;
            string dofsStringSetting = null;

            if (!inst.TryGetNaturalSetting(LimitSettingName, solver.Configuration, flags, 8, ref inst.limitSetting, out cnstVal) |
                !inst.TryGetNaturalSetting(SolsPerIncSettingName, solver.Configuration, flags, 1, ref inst.solsPerIncSetting, out cnstVal) |
                !inst.TryGetStringSetting(DOFsSettingName, solver.Configuration, flags, null, ref dofsStringSetting, out cnstVal))
            {
                return(null);
            }

            bool success = true;

            if (dofsStringSetting != null)
            {
                var types = dofsStringSetting.Split(ListDelim);
                foreach (var t in types)
                {
                    success = inst.AddDOFs(cnstVal, t, flags) && success;
                }
            }
            else
            {
                //// Every new-kind constructor can be a degree of freedom
                AddDOFs(solver.SymbolTable.Root);
            }

            return(success ? inst : null);
        }