本文整理汇总了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;
}
示例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;
}
示例4: Calculator
protected Calculator(Calculator original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
if (original.tokens != null)
tokens = original.tokens.ToList();
}
示例5: Benchmark
protected Benchmark(Benchmark original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
}
示例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);
}
示例7: Clone
public override IDeepCloneable Clone(Cloner cloner) {
// distance matrices are not cloned for performance reasons
cloner.RegisterClonedObject(this, this);
return this;
}
示例8: HiveItem
protected HiveItem(HiveItem original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
this.Id = original.Id;
modified = true;
}
示例9: OKBItem
protected OKBItem(OKBItem original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
modified = true;
}
示例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);
}
示例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();
}
示例12: Item
protected Item(Item original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
}
示例13: DeepCloneable
protected DeepCloneable(DeepCloneable original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
}
示例14: MessageContainer
protected MessageContainer(MessageContainer original, Cloner cloner) {
cloner.RegisterClonedObject(original, this);
this.Message = original.Message;
this.TaskId = original.TaskId;
}