当前位置: 首页>>代码示例>>C#>>正文


C# IGenerator类代码示例

本文整理汇总了C#中IGenerator的典型用法代码示例。如果您正苦于以下问题:C# IGenerator类的具体用法?C# IGenerator怎么用?C# IGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IGenerator类属于命名空间,在下文中一共展示了IGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DiscoTask

 public DiscoTask(Settings settings, IGenerator<amBXScene> randomSceneGenerator, NotificationClientBase notificationService, Random random)
 {
     this.settings = settings;
       this.randomSceneGenerator = randomSceneGenerator;
       this.notificationService = notificationService;
       this.random = random;
 }
开发者ID:usmanatron,项目名称:amBXPeripheralController,代码行数:7,代码来源:DiscoTask.cs

示例2: ProcessTree

        private static void ProcessTree(Option<IAbstractSyntaxTree> ast, IGenerator generator)
        {
            if (!ast.Any())
                return;

            generator.Process(ast.Single());
        }
开发者ID:zoran-horvat,项目名称:parsing-demos,代码行数:7,代码来源:Program.cs

示例3: VertexSourceAdapter

 public VertexSourceAdapter(IVertexSource vertexSource, IGenerator generator)
 {
     markers = new null_markers();
     this.VertexSource = vertexSource;
     this.generator = generator;
     m_status = status.initial;
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:7,代码来源:VertexSourceAdapter.cs

示例4: Learn

        /// <summary>
        /// Trains a single model based on a generator
        /// a predefined number of times with the provided
        /// examples and data split and selects the best 
        /// (or most accurate) model
        /// </summary>
        /// <param name="examples">Source data</param>
        /// <param name="trainingPercentage">Data split percentage</param>
        /// <param name="repeat">Number of repetitions per generator</param>
        /// <param name="generator">Model generator used</param>
        /// <returns>Best model for provided generator</returns>
        public static LearningModel Learn(IEnumerable<object> examples, double trainingPercentage, int repeat, IGenerator generator)
        {
            var total = examples.Count();
            var descriptor = generator.Descriptor;
            var data = descriptor.Convert(examples).ToExamples();

            Matrix x = data.Item1;
            Vector y = data.Item2;

            var models = new IModel[repeat];
            var accuracy = Vector.Zeros(repeat);

            // run in parallel since they all have
            // read-only references to the data model
            // and update indices independently
            Parallel.For(0, models.Length, i =>
            {
                var t = GenerateModel(generator, x, y, examples, trainingPercentage);
                models[i] = t.Model;
                accuracy[i] = t.Accuracy;
            });

            var idx = accuracy.MaxIndex();

            return new LearningModel { Generator = generator, Model = models[idx], Accuracy = accuracy[idx] };
        }
开发者ID:budbjames,项目名称:numl,代码行数:37,代码来源:Learner.cs

示例5: GenerateWithWatch

        private static void GenerateWithWatch(IGenerator g)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\r\n{0}: ", g);
            Console.ResetColor();
            Console.Write("Working...\r\n");

            List<string> result = null;
            var sw = new Stopwatch();
            var total = 0L;
            for (int i = 0;i < _loop;i++)
            {
                sw.Reset();
                sw.Start();
                result = g.Generate(DIC, _len);
                sw.Stop();
                total += sw.ElapsedMilliseconds;
                if (i <= 10)
                {
                    Console.WriteLine("\tGot {0} items in {1,7}ms", result.Count, sw.ElapsedMilliseconds);
                    if (i == 10 && _loop > 10)
                    {
                        Console.WriteLine("\t......");
                    }
                }
            }
            Console.WriteLine("\tGenerate finished for {2} times in {0,7}ms, {1,7}ms for each time.", total, total / _loop, _loop);
            if (result != null)
            {
                PrintTheResult(result);
            }
        }
开发者ID:uonun,项目名称:Whois,代码行数:32,代码来源:Program.cs

示例6: HelloWorldController

        public HelloWorldController(IGenerator generator)
        {
            if (generator == null)
                throw new ArgumentNullException("generator");

            _Generator = generator;
        }
开发者ID:ZeroSharp,项目名称:RoslynPlugins,代码行数:7,代码来源:HelloWorldController.cs

示例7: Main

        public static void Main(string[] args)
        {
            var targetDirectory = Path.GetFullPath(args.Length > 0 ? args[0] : ".");
            var outputDirectory = Path.GetFullPath(args.Length > 1 ? args[1] : ".");
            var options = args.Length > 2 ? args[2] : "";

            if (!Directory.Exists(targetDirectory))
                return;

            if (!Directory.Exists(outputDirectory))
                MiscUtil.CreateDirectory(outputDirectory);

            var generators = new IGenerator[]
                {
                    new MessageCodeGenerator(outputDirectory, options),
                    new DataCodeGenerator(outputDirectory),
                    new AttributeCodeGenerator(outputDirectory)
                };

            var targetFiles = Directory.GetFiles(targetDirectory, "*.xml", SearchOption.AllDirectories);
            Parallel.ForEach(targetFiles, eachFile =>
                {
                    var document = new XmlDocument();
                    document.Load(eachFile);

                    Parallel.ForEach(generators, e => e.Load(eachFile, document));
                });

            Parallel.ForEach(generators, e => e.Generate());
        }
开发者ID:ktj007,项目名称:mmo,代码行数:30,代码来源:Program.cs

示例8: Field

 public Field(IGenerator generator)
 {
     _generator = generator;
     _generator.Generate(this);
     if (_tiles == null || _types == null)
         throw new Exception("Generator failed. Tiles or TileTypes missing!");
 }
开发者ID:cry-inc,项目名称:mahjong,代码行数:7,代码来源:Field.cs

示例9: ConverterAdaptorVcgen

 ///<summary>
 ///</summary>
 ///<param name="source"></param>
 ///<param name="generator"></param>
 public ConverterAdaptorVcgen(IVertexSource source, IGenerator generator)
 {
     _markers = new NullMarkers();
     _source = source;
     _generator = generator;
     _status = EStatus.Initial;
 }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:11,代码来源:VcGenConverterAdaptor.cs

示例10: PerformSampling

 public void PerformSampling(string name, IGenerator layer)
 {
     PerformSamplingIndividual(name, layer, 5, 0);
     PerformSamplingIndividual(name, layer, 5, 100);
     PerformSamplingIndividual(name, layer, 5, 10000);
     PerformSamplingIndividual(name, layer, 5, 10000000);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:7,代码来源:ContinuityTests.cs

示例11: Setup

		public void Setup()
		{
			ccu = new CodeCompileUnit();
			mocks = new MockRepository();
			engine = Engine.GlobalEngine;
			engine.BinPath = @"C:\Program Files (x86)\MSBuild";
			project = new Project();
			buildEngine = mocks.DynamicMock<MockBuildEngine>(project);

			logger = new NullLogger();
			parserService = mocks.DynamicMock<ISiteTreeGeneratorService>();
			naming = mocks.DynamicMock<INamingService>();
			sourceStorage = mocks.DynamicMock<IParsedSourceStorageService>();
			source = mocks.DynamicMock<ISourceGenerator>();
			typeResolver = mocks.DynamicMock<ITypeResolver>();
			treeService = mocks.DynamicMock<ITreeCreationService>();
			viewSourceMapper = mocks.DynamicMock<IViewSourceMapper>();
			generator = mocks.DynamicMock<IGenerator>();

			task = new GenerateMonoRailSiteTreeTask(logger, parserService, naming, source, sourceStorage, typeResolver,
			                                         treeService, viewSourceMapper, generator);

			item = mocks.DynamicMock<ITaskItem>();
			parsedSource = mocks.DynamicMock<IParser>();
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:25,代码来源:GenerateMonoRailSiteTreeTaskTests.cs

示例12: Emit

 public void Emit(IGenerator codeEmittor)
 {
     foreach(var i in _instructions)
     {
         i.Emit(codeEmittor);
     }
 }
开发者ID:michaelgwelch,项目名称:brainmess,代码行数:7,代码来源:InstructionContainer.cs

示例13: BuildBuffers

        private void BuildBuffers(IGenerator generator)
        {
            List<MyOwnVertexFormat> vertices = new List<MyOwnVertexFormat>();

            for (int x = 0; x < sideSize; x++)
            {
                for (int z = 0; z < sideSize; z++)
                {

                    for (int y = 0; y < sideSize; y++)
                    {
                        double sample = generator.Sample(new Vector3(x, y, z) + location);
                        if ( sample > 0.6f)
                        {
                            CreateVertices(vertices, x, y, z, new Color((float)sample, (float)sample, (float)sample));
                        }

                    }
                }
            }

            if(vertices.Count > 0)
            {
                vertexBuffer = new VertexBuffer(device, MyOwnVertexFormat.VertexDeclaration, vertices.Count, BufferUsage.WriteOnly);
                vertexBuffer.SetData(vertices.ToArray());
            }

            numVertices = vertices.Count;
        }
开发者ID:nordsoyv,项目名称:GraphicsFun,代码行数:29,代码来源:GeneratingLeafNode.cs

示例14: Generator

 /// <summary>
 /// Initializes a new instance of a Generator.
 /// </summary>
 /// <param name="generator">The text generator to wrap.</param>
 internal Generator(IGenerator generator)
 {
     _generator = generator;
     _foundHandlers = new List<EventHandler<KeyFoundEventArgs>>();
     _notFoundHandlers = new List<EventHandler<KeyNotFoundEventArgs>>();
     _valueRequestedHandlers = new List<EventHandler<ValueRequestEventArgs>>();
 }
开发者ID:sheigl,项目名称:mustache-sharp,代码行数:11,代码来源:Generator.cs

示例15: Toolchain

 public Toolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor)
 {
     Name = name;
     Generator = generator;
     Builder = builder;
     Executor = executor;
 }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:7,代码来源:Toolchain.cs


注:本文中的IGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。