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


C# ISelection类代码示例

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


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

示例1: SelectionIsReadOnly

		internal static bool SelectionIsReadOnly(IDocument document, ISelection sel)
		{
			if (document.TextEditorProperties.SupportReadOnlySegments)
				return document.MarkerStrategy.GetMarkers(sel.Offset, sel.Length).Exists(m=>m.IsReadOnly);
			else
				return false;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:SelectionManager.cs

示例2: AdvanceGeneration

        static Population AdvanceGeneration(Population population, ISelection selection, ICrossover crossover, IMutation mutation)
        {
            var chromosomes = new List<Chromosome>();
            population = new Population(population.Take((int)(truncationRate * population.Count()))); // TRUNCATION
            chromosomes.AddRange(population.Take((int)(elitismRate * chromosomeCount)));  //ELITE (assuming that the chromosomes in the population are sorted by fitness (the fitter are at the top of the list)

            do
            {
                Chromosome chosen1 = selection.Select(population),
                           chosen2 = selection.Select(population);

                if (random.NextDouble() < crossoverRate)
                {
                    var children = crossover.Crossover(chosen1, chosen2); // CROSSOVER
                    chosen1 = children.Item1;
                    chosen2 = children.Item2;
                }

                if (random.NextDouble() < mutationRate)
                {
                    chosen1 = mutation.Mutate(chosen1); // MUTATION
                }

                if (random.NextDouble() < mutationRate)
                {
                    chosen2 = mutation.Mutate(chosen2); // MUTATION
                }

                chromosomes.Add(chosen1);
                chromosomes.Add(chosen2);
            } while (chromosomes.Count < chromosomeCount);

            return new Population(chromosomes);
        }
开发者ID:dreasgrech,项目名称:StringEvolver,代码行数:34,代码来源:Program.cs

示例3: FindJumpInstructionsVisitor

		public FindJumpInstructionsVisitor(MethodDeclaration method, ISelection selection)
		{
			this.method = method;
			this.selection = selection;
			this.labels = new List<LabelStatement>();
			this.cases = new List<CaseLabel>();
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:FindJumpInstructionsVisitor.cs

示例4: Population

        public Population(int size, IFitnessFunction fitnessFunction, IReproduction reproductionFunction, INodeMutator mutator, ISelection selection)
        {
            this.populationSize = size;
            this.fitnessFunction = fitnessFunction;
            this.reproductionFunction = reproductionFunction;
            this.mutator = mutator;
            this.selector = selection;

            this.fitnessFunction.Initialise();

            // Create the initial population
            for (int i = 0; i < size; i++)
            {
                try
                {
                    NodeContext zeroContext = new NodeContext();
                    zeroContext.AvailableCollections = fitnessFunction.GetCollections();
                    zeroContext.AvailableInputs = fitnessFunction.GetInputs();

                    INode candidateNode = NodeFactory.GenerateNode(zeroContext);

                    // Make sure we have a decent candidate (i.e. not too large)
                    double fitness = this.fitnessFunction.CalculateFitness(candidateNode);
                    if (fitness == Double.MaxValue) continue;

                    this.population.Add(NodeFactory.GenerateNode(zeroContext));
                }
                catch (StackOverflowException)
                {
                }
            }
        }
开发者ID:geoffsmith,项目名称:Genetic-Programming,代码行数:32,代码来源:Population.cs

示例5: Population

 /// <summary>
 /// Constructor
 /// </summary>
 public Population(int size,
     IIndividual ancestor,
     IFitnessFunction fitnessFunction,
     ISelection selectionMethod,
     int numberIterations)
 {
     FitnessFunction = fitnessFunction;
     Selection = Replacement = selectionMethod;
     PopulationSize = size;
     firstSelectionCount = size;
     firstReplacementCount = ((int)(size / 2)) % 2 == 0 ? (int)(size / 2) : (int)(size / 2) + 1;
     iterations = numberIterations;
     // Agregar el ancestro a la poblacion
     ancestor.Evaluate(fitnessFunction);
     Individuals.Add(ancestor);
     // Se agregan mas cromosomas a la poblacion
     for (int i = 1; i < size; i++)
     {
         // Se crea un nuevo cromosoma al azar
         IIndividual c = ancestor.CreateRandomIndividual();
         // se calcula su aptitud
         c.Evaluate(fitnessFunction);
         // Se lo agrega a la poblacion
         Individuals.Add(c);
     }
 }
开发者ID:nbombau,项目名称:geneticalgorithms,代码行数:29,代码来源:Population.cs

示例6: ProxySelection

 public ProxySelection(ISelection selection)
 {
     _selection = selection;
     _numberOfGoodStarts = 0;
     _numberOfBadStarts = 0;
     _progressList = new List<double> { 1 };
     _progress = OneHundredPercent;
 }
开发者ID:nettakogo87,项目名称:GeneticEngine,代码行数:8,代码来源:ProxySelection.cs

示例7: MethodExtractorBase

		public MethodExtractorBase(ICSharpCode.TextEditor.TextEditorControl textEditor, ISelection selection)
		{
			this.currentDocument = textEditor.Document;
			this.textEditor = textEditor;
			this.currentSelection = selection;
			
			this.start = new Location(this.currentSelection.StartPosition.Column + 1, this.currentSelection.StartPosition.Line + 1);
			this.end = new Location(this.currentSelection.EndPosition.Column + 1, this.currentSelection.EndPosition.Line + 1);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:MethodExtractorBase.cs

示例8: DecreaseSelection

        public DecreaseSelection(IDocument document, ISelection selection)
        {
            if (document == null) throw new ArgumentNullException("document");
            if (selection == null) throw new ArgumentNullException("selection");
            this.itsDocument = document;
            itsOffset = selection.Offset + 1;
            itsEndOffset = selection.EndOffset - 1;;

            itsSelectedText = document.TextContent.Substring(Offset, EndOffset-Offset);
        }
开发者ID:marcusholmgren,项目名称:SharpSelectWord,代码行数:10,代码来源:DecreaseSelection.cs

示例9: getProjectFromSelection

		public static IProject getProjectFromSelection(ISelection selection) {
			var resource = getResourceFromSelection(selection);
			if (resource == null) {
				return null;
			}
			if (resource.getType() == IResource.PROJECT) {
				return (IProject)resource;
			} else {
				return resource.getProject();
			}
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:11,代码来源:EclipseHelper.stab.cs

示例10: GetComplexArrayFrom1DSelection

		public static Complex[] GetComplexArrayFrom1DSelection(ISelection selection) {
			int size = selection.Size;

			var result = new Complex[size];
			var i = 0;
			foreach(var v in selection){
				result[i] = new Complex(v[0], 0);
				i++;
			}

			return result;
		}
开发者ID:ramshteks,项目名称:csalgs-lib,代码行数:12,代码来源:Fourier.cs

示例11: SelectionIsReadOnly

		internal static bool SelectionIsReadOnly(IDocument document, ISelection sel)
		{
            //johnny
            //if (document.TextEditorProperties.SupportReadOnlySegments)
            //    return document.MarkerStrategy.GetMarkers(sel.Offset, sel.Length).Exists(m=>m.IsReadOnly);
            if (document.TextEditorProperties.SupportReadOnlySegments)
            {
                return document.MarkerStrategy.GetMarkers(sel.Offset, sel.Length).Exists(delegate(TextMarker m) { return m.IsReadOnly; });
            }
            else
                return false;
		}
开发者ID:jojozhuang,项目名称:Projects,代码行数:12,代码来源:SelectionManager.cs

示例12: CallAllProperties

 internal static void CallAllProperties(ISelection selection)
 {
     selection.ContainsOffset(0);
     selection.ContainsPosition(TextLocation.Empty);
     int offset = selection.EndOffset;
     TextLocation position = selection.EndPosition;
     bool empty = selection.IsEmpty;
     bool rectangularSelection = selection.IsRectangularSelection;
     int length = selection.Length;
     int offset2 = selection.Offset;
     string text = selection.SelectedText;
     TextLocation startPosition = selection.StartPosition;
 }
开发者ID:marcusholmgren,项目名称:SharpSelectWord,代码行数:13,代码来源:TestHelper.cs

示例13: ExtendBlockSelection

        /// <summary>
        /// Initialize a new instance of the ExtendBlockSelection class.
        /// </summary>
        /// <param name="document">Object that implements the IDocument interface.</param>
        /// <param name="selection">The current selection.</param>
        public ExtendBlockSelection(IDocument document, ISelection selection)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            if (selection == null)
                throw new ArgumentNullException("selection");

            itsDocument = document;
            itsOffset = selection.Offset;
            itsEndOffset = selection.EndOffset;

            ExtendCurrentSelection();
        }
开发者ID:marcusholmgren,项目名称:SharpSelectWord,代码行数:19,代码来源:ExtendBlockSelection.cs

示例14: ReverseSelection

        private static ISelection ReverseSelection(ISelection selection)
        {
            var list = new ArrayList();

            if (selection != null && selection.Items != null)
            {
                foreach (object o in selection.Items)
                    list.Add(o);

                list.Reverse();
            }

            return new Selection(list);
        }
开发者ID:CuriousX,项目名称:annotation-and-image-markup,代码行数:14,代码来源:RetrieveProgressComponentControl.cs

示例15: TwoIslandsPopulation

        public TwoIslandsPopulation(int size, IFitnessFunction fitnessFunction, IReproduction reproductionFunction, INodeMutator mutator, ISelection selection)
        {
            this.populationSize = size;
            this.fitnessFunction = fitnessFunction;
            this.reproductionFunction = reproductionFunction;
            this.mutator = mutator;
            this.selector = selection;

            this.fitnessFunction.Initialise();

            // The main population needs initializing
            this.IntialisePopulation(this.mainPopulation);

            this.IntialisePopulation(this.secondaryPopulation);
        }
开发者ID:geoffsmith,项目名称:Genetic-Programming,代码行数:15,代码来源:TwoIslandsPopulation.cs


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