本文整理汇总了C#中INode.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# INode.Clone方法的具体用法?C# INode.Clone怎么用?C# INode.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INode
的用法示例。
在下文中一共展示了INode.Clone方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegressionAlgorithm
public RegressionAlgorithm(INode expression, IList<double[]> arguments, IList<double> result, double accurance = 0.0001, double lambda = 0.0001)
{
_inSamples = arguments;
_exactResult = result;
_precision = accurance;
_lambda = lambda;
Formula = expression.Clone<INode>();
InConstant = new List<double>();
BuildFunctional();
_functional = Formula.ComplileDelegate<double>();
ApproximationError = GetApproximationError(InConstant);
}
示例2: Reproduce
/// <summary>
/// A very simple reproduction algorithm. It starts with parent A and takes a single node
/// from each parent and performs a crossover with those nodes.
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public INode Reproduce(INode a, INode b)
{
// Clone parent A to start with
INode child = (INode) a.Clone();
// Get all the nodes in the child and parent b
List<INode> childNodes = child.GetNodes();
List<INode> bNodes = b.GetNodes();
// Get a random node from the child and b
INode childCrossoverNode = childNodes[RandomUtil.Random.Next(childNodes.Count - 1)];
List<INode> bCandidates = FindNodeWithMatchingContext(childCrossoverNode, bNodes);
if (bCandidates.Count == 0) return child;
INode bCrossoverNode = bCandidates[RandomUtil.Random.Next(bCandidates.Count)];
childCrossoverNode.ReplaceChild((INode) bCrossoverNode.Clone());
return child;
}
示例3: DivideNode
public DivideNode(NodeContext context, INode numerator, INode denomiator)
{
this.context = (NodeContext) context.Clone();
this.numerator = (INode) numerator.Clone();
this.denomiator = (INode) denomiator.Clone();
}
示例4: Import
/// <summary>
/// Creates a copy of a node from an external document that can be
/// inserted into the current document.
/// </summary>
/// <param name="externalNode">
/// The node from another document to be imported.
/// </param>
/// <param name="deep">
/// Optional argument, indicating whether the descendants of the
/// imported node need to be imported.
/// </param>
/// <returns>
/// The new node that is imported into the document. The new node's
/// parentNode is null, since it has not yet been inserted into the
/// document tree.
/// </returns>
public INode Import(INode externalNode, Boolean deep = true)
{
if (externalNode.NodeType == NodeType.Document)
throw new DomException(DomError.NotSupported);
return externalNode.Clone(deep);
}
示例5: CloneAndSet
static INode[] CloneAndSet(INode[] array, int i, INode a)
{
INode[] clone = (INode[])array.Clone();
clone[i] = a;
return clone;
}
示例6: SumNode
public SumNode(NodeContext context, int collectionIndex, INode sumFunction)
{
this.Context = (NodeContext) context.Clone();
this.collectionIndex = collectionIndex;
this.sumFunction = (INode) sumFunction.Clone();
}
示例7: SubtractNode
public SubtractNode(NodeContext context, INode left, INode right)
{
this.context = (NodeContext) context.Clone();
this.left = (INode) left.Clone();
this.right = (INode) right.Clone();
}
示例8: AddNode
public AddNode(NodeContext context, INode right, INode left)
{
this.context = (NodeContext) context.Clone();
this.right = (INode) right.Clone();
this.left = (INode) left.Clone();
}
示例9: MultiplyNode
public MultiplyNode(NodeContext context, INode left, INode right)
{
this.context = (NodeContext) context.Clone();
this.left = (INode) left.Clone();
this.right = (INode) right.Clone();
}