本文整理汇总了C#中Signal.DependsOn方法的典型用法代码示例。如果您正苦于以下问题:C# Signal.DependsOn方法的具体用法?C# Signal.DependsOn怎么用?C# Signal.DependsOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal.DependsOn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeparateFactors
/// <summary>
/// Separates factors in a product that depend on x from those that do not.
/// </summary>
/// <returns>
/// A signal array [a,b], where a is the product of the factors not
/// depending on x, and b the product of those depending on x.
/// </returns>
/// <remarks><see cref="product"/> is assumed to be automatic simplified</remarks>
public static Signal[] SeparateFactors(Signal product, Signal x)
{
SignalSet freePart = new SignalSet();
SignalSet dependentPart = new SignalSet();
if(product.IsDrivenByPortEntity("Multiply", "Std"))
{
ISignalSet factors = product.DrivenByPort.InputSignals;
foreach(Signal s in factors)
{
if(s.DependsOn(x))
dependentPart.Add(s);
else
freePart.Add(s);
}
}
else if(product.DependsOn(x))
dependentPart.Add(product);
else
freePart.Add(product);
Signal freeSignal = Multiply(freePart);
Signal dependentSignal = Multiply(dependentPart);
return new Signal[] { freeSignal, dependentSignal };
}