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


C# Cloner.RegisterClonedObject方法代码示例

本文整理汇总了C#中Cloner.RegisterClonedObject方法的典型用法代码示例。如果您正苦于以下问题:C# Cloner.RegisterClonedObject方法的具体用法?C# Cloner.RegisterClonedObject怎么用?C# Cloner.RegisterClonedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cloner的用法示例。


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

示例1: TaskData

 protected TaskData(TaskData original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   if (original.Data != null) {
     this.Data = new byte[original.Data.Length];
     Array.Copy(original.Data, this.Data, original.Data.Length);
   }
   this.LastUpdate = original.LastUpdate;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:8,代码来源:TaskData.cs

示例2: CreateModel

    /// <summary>
    /// It is necessary to create new models of an unknown type with new trees in the simplifier.
    /// For this purpose the cloner is used by registering the new tree as already cloned object and invoking the clone mechanism.
    /// This results in a new model of the same type as the old one with an exchanged tree.
    /// </summary>
    /// <param name="tree">The new tree that should be included in the new object</param>
    /// <returns></returns>
    protected ISymbolicClassificationModel CreateModel(ISymbolicExpressionTree tree) {
      var cloner = new Cloner();
      cloner.RegisterClonedObject(Content.Model.SymbolicExpressionTree, tree);

      var model = (ISymbolicClassificationModel)Content.Model.Clone(cloner);
      model.RecalculateModelParameters(Content.ProblemData, Content.ProblemData.TrainingIndices);
      return model;
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:15,代码来源:InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs

示例3: Job

 protected Job(Job original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   this.OwnerUserId = original.OwnerUserId;
   this.DateCreated = original.DateCreated;
   this.ResourceNames = original.ResourceNames;
   this.Name = original.Name;
   this.Description = original.Description;
   this.Id = original.Id;
   this.Permission = original.Permission;
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:10,代码来源:Job.cs

示例4: Calculator

 protected Calculator(Calculator original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   if (original.tokens != null)
     tokens = original.tokens.ToList();
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:5,代码来源:Calculator.cs

示例5: Benchmark

 protected Benchmark(Benchmark original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:3,代码来源:Benchmark.cs

示例6: BenchmarkAlgorithm

 private BenchmarkAlgorithm(BenchmarkAlgorithm original, Cloner cloner) {
   if (original.ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
   cloner.RegisterClonedObject(original, this);
   name = original.name;
   description = original.description;
   parameters = cloner.Clone(original.parameters);
   readOnlyParameters = null;
   executionState = original.executionState;
   executionTime = original.executionTime;
   storeAlgorithmInEachRun = original.storeAlgorithmInEachRun;
   runsCounter = original.runsCounter;
   Runs = cloner.Clone(original.runs);
   results = cloner.Clone(original.results);
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:14,代码来源:BenchmarkAlgorithm.cs

示例7: Clone

 public override IDeepCloneable Clone(Cloner cloner) {
   // distance matrices are not cloned for performance reasons
   cloner.RegisterClonedObject(this, this);
   return this;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:5,代码来源:DistanceMatrix.cs

示例8: HiveItem

 protected HiveItem(HiveItem original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   this.Id = original.Id;
   modified = true;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:5,代码来源:HiveItem.cs

示例9: OKBItem

 protected OKBItem(OKBItem original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   modified = true;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:4,代码来源:OKBItem.cs

示例10: Clone

 public override IDeepCloneable Clone(Cloner cloner) {
   foreach (ISymbol symbol in base.Symbols)
     if (!cloner.ClonedObjectRegistered(symbol))
       cloner.RegisterClonedObject(symbol, symbol);
   return new SymbolicExpressionTreeGrammar(this, cloner);
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:6,代码来源:SymbolicExpressionTreeGrammar.cs

示例11: Apply

    public override IOperation Apply() {
      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
      ResultCollection results = ResultsParameter.ActualValue;
      bool max = MaximizationParameter.ActualValue.Value;
      DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;

      if (results.ContainsKey(BestSolutionResultName) && !typeof(IScope).IsAssignableFrom(results[BestSolutionResultName].DataType)) {
        throw new InvalidOperationException(string.Format("Could not add best solution result, because there is already a result with the name \"{0}\" present in the result collection.", BestSolutionResultName));
      }

      int i = -1;
      if (!max)
        i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
      else i = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;

      IEnumerable<IScope> scopes = new IScope[] { ExecutionContext.Scope };
      for (int j = 0; j < QualityParameter.Depth; j++)
        scopes = scopes.SelectMany(x => x.SubScopes);
      IScope currentBestScope = scopes.ToList()[i];

      if (bestKnownQuality == null ||
          max && qualities[i].Value > bestKnownQuality.Value
          || !max && qualities[i].Value < bestKnownQuality.Value) {
        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
      }

      if (!results.ContainsKey(BestSolutionResultName)) {
        var cloner = new Cloner();
        //avoid cloning of subscopes and the results collection that the solution is put in
        cloner.RegisterClonedObject(results, new ResultCollection());
        cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
        var solution = cloner.Clone(currentBestScope);

        results.Add(new Result(BestSolutionResultName, solution));
      } else {
        var bestSolution = (IScope)results[BestSolutionResultName].Value;
        string qualityName = QualityParameter.TranslatedName;
        if (bestSolution.Variables.ContainsKey(qualityName)) {
          double bestQuality = ((DoubleValue)bestSolution.Variables[qualityName].Value).Value;
          if (max && qualities[i].Value > bestQuality
              || !max && qualities[i].Value < bestQuality) {
            var cloner = new Cloner();
            //avoid cloning of subscopes and the results collection that the solution is put in
            cloner.RegisterClonedObject(results, new ResultCollection());
            cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
            var solution = cloner.Clone(currentBestScope);

            results[BestSolutionResultName].Value = solution;
          }
        }
      }
      return base.Apply();
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:53,代码来源:BestScopeSolutionAnalyzer.cs

示例12: Item

 protected Item(Item original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:3,代码来源:Item.cs

示例13: DeepCloneable

 protected DeepCloneable(DeepCloneable original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:3,代码来源:DeepCloneable.cs

示例14: MessageContainer

 protected MessageContainer(MessageContainer original, Cloner cloner) {
   cloner.RegisterClonedObject(original, this);
   this.Message = original.Message;
   this.TaskId = original.TaskId;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:5,代码来源:MessageContainer.cs


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