public override bool Execute() { var referenceCopyLocalPaths = ReferenceCopyLocalPaths.Select(x => x.ItemSpec).ToList(); var defineConstants = DefineConstants.GetConstants(); processor = new Processor { Logger = new BuildLogger { BuildEngine = BuildEngine, }, AssemblyFilePath = AssemblyPath, IntermediateDirectory = IntermediateDir, KeyFilePath = KeyFilePath, SignAssembly = SignAssembly, ProjectDirectory = ProjectDirectory, References = References, SolutionDirectory = SolutionDir, ReferenceCopyLocalPaths = referenceCopyLocalPaths, DefineConstants = defineConstants, NuGetPackageRoot = NuGetPackageRoot }; var success = processor.Execute(); if (success) { var weavers = processor.Weavers.Select(x => x.AssemblyName); ExecutedWeavers = string.Join(";", weavers) + ";"; } return success; }
public void EmptyModuleDeclaration() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { }"); dynamic result = processor.Evaluate("return Modules"); Assert.AreEqual(2, result.Count); }
public void EmptyScript() { var processor = new Processor(); processor.Execute("//Nothing but a comment"); var result = processor.Evaluate("//Nothing but a comment"); Assert.IsNull(result); }
private static void ParallelTasks() { Console.WriteLine("BP Console: running tasks.\n"); Processor proc = new Processor(PARALLEL_PROCESSING, ConfigReader.GetTaskList("ParallelTasks.config") ); proc.Execute(); }
private static void TearDownTasks() { Console.WriteLine("BP Console: running tear down tasks.\n"); Processor proc = new Processor(SERIAL_PROCESSING, ConfigReader.GetTaskList("TearDownTasks.config") ); proc.Execute(); }
private static void SetupTasks() { Console.WriteLine("BP Console: running set up tasks.\n"); Processor proc = new Processor(SERIAL_PROCESSING, ConfigReader.GetTaskList("SetupTasks.config") ); proc.Execute(); Console.WriteLine("BP Console: setup complete.\n"); }
public void InitializeProvider() { string moduleCode; using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Ancestry.QueryProcessor.Sql.Test.Module.dql"))) moduleCode = reader.ReadToEnd(); var settings = new ProcessorSettings(); settings.RepositoryFactory = new SqlFactory("System.Data.SqlServerCe.4.0", "Data Source=TestDB.sdf;Persist Security Info=False;"); _processor = new Processor(settings); _processor.Execute(moduleCode); }
public void doWork(string[] args) { GeneticAPI.JsonFileReader<City> importer = new GeneticAPI.JsonFileReader<City>(); List<City> lo_data = importer.Import(args[0]); for (int i = 0; i < lo_data.Count; i++) { Console.WriteLine(lo_data[i].id); } Processor<City> lo_processor = new Processor<City>(); lo_processor.Changed += new ChangedEventHandler(Changed); lo_processor.Execute(lo_data, 30, 200000, 0.001, 0.5, GeneticAPI.Selection.Selectors.Tournament,GeneticAPI.Recombination.Recombinators.TwoPointCrossoverPMX, GeneticAPI.Shared.Util.Randoms.Advanced, 2, 4); }
/// <summary> /// Runs the compiled code /// </summary> public void Run() { Console.WriteLine("Delabeled code:"); Console.WriteLine(Utils.PrintCode(compiler.code)); Console.WriteLine("\nInstructions:"); Console.WriteLine(Utils.PrintInstructions(compiler.instructions)); Console.WriteLine("Press enter to execute."); Console.ReadLine(); Processor processor = new Processor(compiler.instructions); processor.Execute(); Console.WriteLine("\nPress enter to exit."); Console.ReadLine(); }
public override bool Execute() { var referenceCopyLocalPaths = ReferenceCopyLocalPaths.Select(x => x.ItemSpec).ToList(); var defineConstants = DefineConstants.GetConstants(); processor = new Processor { Logger = new BuildLogger { BuildEngine = BuildEngine, }, AssemblyFilePath = AssemblyPath, IntermediateDirectory = IntermediateDir, KeyFilePath = KeyFilePath, SignAssembly = SignAssembly, ProjectDirectory = ProjectDirectory, References = References, SolutionDirectory = SolutionDir, ReferenceCopyLocalPaths = referenceCopyLocalPaths, DefineConstants = defineConstants }; return processor.Execute(); }
public void SimpleModuleEnum() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyEnum: enum { Red Green } }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 return Green"); Assert.AreEqual("Green", result.ToString()); }
public void EmptyScript() { var processor = new Processor(); processor.Execute("//Nothing but a comment"); var result = processor.Evaluate("//Nothing but a comment"); Assert.IsNull(result.Result); Assert.AreEqual(result.Type, SystemTypes.Void); }
public void ModuleSelfReferencing() { // TODO: FIX const values - cannot compile builders into a dynamic method var processor = new Processor(); processor.Execute ( @" module TestModule 1.0.0 { ForwardTypedef: Int, ForwardEnum: Color, //ForwardEnumValue: const Red, //ForwardConst: const Five, Int: typedef Int32, Color: enum { Red Green }, Five: const 5, BackwardTypedef: { x: Int }, BackwardEnum: Color, //BackwardEnumValue: const Green, //BackwardConst: const Five } " ); }
public void SimpleModuleFunctionVar() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyFunc: (x: Int32) : Int32 }"); dynamic result = processor.Evaluate ( @" using TestModule 1.0.0 set MyFunc := (x: Int32) return x + 1 return MyFunc(5) " ); Assert.AreEqual(6, result.Result); }
public void TupleModuleVar() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyTup: { x:Int32 }, MyInt: Int32, MySet: { Int32 } }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 return MyTup.x"); Assert.AreEqual(0, result.Result); result = processor.Evaluate("using TestModule 1.0.0 return MyInt + 5"); Assert.AreEqual(5, result.Result); result = processor.Evaluate("using TestModule 1.0.0 set MySet := { -5, 5 } return MySet(value > 0)"); Assert.AreEqual(1, Enumerable.Count(result.Result)); result = processor.Evaluate ( @"using TestModule 1.0.0 let f := (x: Int32, y: Int32) return x + y return { a: f(MyInt, 5), b: f(5, MyInt) }" ); Assert.AreEqual(5, result.Result.a); Assert.AreEqual(5, result.Result.b); }
public void Index(string e, string a = null) { var service = new Processor(QueryConfig.Settings); service.Execute(e, a == null ? null : JsonInterop.JsonArgsToNative(JObject.Parse(a))); }
public void Transform(XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver) { CheckCommand(); Processor processor = new Processor(input, args, resolver, _CompiledStylesheet, _QueryStore, _RootAction, debugger); processor.Execute(output); }
public void ModuleSelfReferencing() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { Forward: Int Int: typedef Integer Backward: { x: Int } }"); }
public void SimpleModuleConst() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyConst: const 5 }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 return MyConst"); Assert.AreEqual(5, result); }
public void SimpleModuleFunctionVar() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyFunc: (x: Integer) => Integer }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 set MyFunc := (x: Integer) => return x + 1 return 5->MyFunc()"); Assert.AreEqual(6, result); }
public void SimpleModuleVar() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyVar: Integer }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 return MyVar"); Assert.AreEqual(0, result); }
public void Execute() { var processor = new Processor(); processor.Execute("//Do nothing"); }
public void TupleModuleTypedef() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyTypedef: typedef { x:Integer y:String key{ x } } }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 var v : MyTypedef return v = { x:0 y:\"\" key{ x } }"); Assert.IsTrue(result); }
public void Transform(XPathNavigator input, XsltArgumentList args, TextWriter output) { CheckCommand(); Processor processor = new Processor(input, args, _DocumentResolver, _CompiledStylesheet, _QueryStore, _RootAction, _debugger); processor.Execute(output); }
public void TupleModuleVar() { var processor = new Processor(); processor.Execute("module TestModule 1.0.0 { MyTup: { x:Integer } MyInt: Integer MySet: { Integer } }"); dynamic result = processor.Evaluate("using TestModule 1.0.0 return MyTup.x"); Assert.AreEqual(0, result); result = processor.Evaluate("using TestModule 1.0.0 return MyInt + 5"); Assert.AreEqual(5, result); result = processor.Evaluate("using TestModule 1.0.0 set MySet := { -5 5 } return MySet?(value > 0)"); Assert.AreEqual(1, Enumerable.Count(result)); result = processor.Evaluate ( @"using TestModule 1.0.0 let f := (x: Integer y: Integer) => return x + y return { a:MyInt->f(5) b:5->f(MyInt) }" ); Assert.AreEqual(5, result.a); Assert.AreEqual(5, result.b); }
public void StartGA() { string[] args = new string[1]; args[0] = ii_path; //Imports data from JSON file and adds it to list. GeneticAPI.JsonFileReader<City> importer = new GeneticAPI.JsonFileReader<City>(); List<City> lo_data = importer.Import(args[0]); for (int i = 0; i < lo_data.Count; i++) { Console.WriteLine(lo_data[i].id); } Processor<City> lo_processor = new Processor<City>(); //Subscribe to GA. lo_processor.Changed += new ChangedEventHandler(Changed); //Start GA. lo_processor.Execute(lo_data, ii_poolsize, ii_generations, id_modifyprob, id_recomprob, ien_selector, ien_recomb, ien_random, ii_elites, ii_ts_contestants, ib_adaptivemut, ib_rog, ib_lrog); }
public override bool Execute() { var referenceCopyLocalPaths = ReferenceCopyLocalFiles .Select(x => x.ItemSpec) .ToList(); var defineConstants = DefineConstants.GetConstants(); var buildLogger = new BuildLogger { BuildEngine = BuildEngine, }; processor = new Processor { Logger = buildLogger, AssemblyFilePath = AssemblyFile, IntermediateDirectory = IntermediateDirectory, KeyFilePath = KeyOriginatorFile ?? AssemblyOriginatorKeyFile, SignAssembly = SignAssembly, ProjectDirectory = ProjectDirectory, ProjectFilePath = ProjectFile, DocumentationFilePath = DocumentationFile, References = References, SolutionDirectory = SolutionDirectoryFinder.Find(SolutionDirectory, NCrunchOriginalSolutionDirectory, ProjectDirectory), ReferenceCopyLocalPaths = referenceCopyLocalPaths, DefineConstants = defineConstants, Weavers = GetWeaversFromProps().Distinct(WeaverEntry.NameComparer).ToList(), WeaverConfiguration = WeaverConfiguration, GenerateXsd = GenerateXsd }; var success = processor.Execute(); if (success) { var weavers = processor.Weavers.Select(x => x.ElementName); ExecutedWeavers = string.Join(";", weavers) + ";"; try { File.WriteAllLines(IntermediateCopyLocalFilesCache, processor.ReferenceCopyLocalPaths); } catch (Exception exception) { buildLogger.LogInfo("ProjectDirectory: " + ProjectDirectory); buildLogger.LogInfo("IntermediateDirectory: " + IntermediateDirectory); buildLogger.LogInfo("CurrentDirectory: " + Directory.GetCurrentDirectory()); buildLogger.LogInfo("AssemblyFile: " + AssemblyFile); buildLogger.LogInfo("IntermediateCopyLocalFilesCache: " + IntermediateCopyLocalFilesCache); buildLogger.LogError("Error writing IntermediateCopyLocalFilesCache: " + exception.Message); return(false); } return(true); } if (File.Exists(IntermediateCopyLocalFilesCache)) { File.Delete(IntermediateCopyLocalFilesCache); } return(false); }