本文整理汇总了C#中Function.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# Function.Apply方法的具体用法?C# Function.Apply怎么用?C# Function.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Function
的用法示例。
在下文中一共展示了Function.Apply方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyExpressions
public void ApplyExpressions()
{
var func = new Function(new MapType(IntegerType.Instance, IntegerType.Instance));
func.Map(new IntegerExpression(1), new IntegerExpression(2));
Assert.AreEqual(new IntegerExpression(2), func.Apply(new IExpression[] { new IntegerExpression(1) }));
}
示例2: ApplyExpression
public void ApplyExpression()
{
var type = new MapType(IntegerType.Instance, IntegerType.Instance);
var func = new Function(type);
Assert.AreSame(func, func.Reduce());
Assert.AreSame(type, func.Type);
func.Map(new IntegerExpression(1), new IntegerExpression(2));
Assert.AreEqual(new IntegerExpression(2), func.Apply(new IntegerExpression(1)));
}
示例3: Update
public void Update(Function f)
{
Cost = f.Apply(X, Y);
if (Cost < Best)
{
Best = Cost;
BestX = X;
BestY = Y;
}
}
示例4: DisegnaFunzione
private void DisegnaFunzione(string funct)
{
try
{
Function F = new Function();
F.Expression = SostituisciAlias(funct).Replace("/","/(float)");
float x, y, ix, iy, ix_old = float.NaN, iy_old = float.NaN;
// traccia la funzione
for (float xx = 0; xx < larghezza; xx +=incremento)
{
x = xmin + ((float)xx) / scala_x;
y = (float)F.Apply(x);
if (!float.IsInfinity(x) && !float.IsInfinity(y) && !float.IsNaN(x) && !float.IsNaN(y))
{
ix = setX(x);
iy = setY(y);
if (!(x < xmin || x > xmax || y < ymin || y > ymax))
{
if (!float.IsNaN(ix_old) && !float.IsNaN(iy_old))
g.DrawLine(penna3, ix_old, iy_old, ix, iy);
}
ix_old = ix;
iy_old = iy;
}
else
{
ix_old = float.NaN;
iy_old = float.NaN;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}