本文整理汇总了C#中Expr.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Expr.Equals方法的具体用法?C# Expr.Equals怎么用?C# Expr.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expr
的用法示例。
在下文中一共展示了Expr.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: genMMA
static public Expr genMMA(Expr ep0, ArrayExpr ep1, String op, Parser.ParseResult pr)
{
if (op == "All")
{
if (!(ep0 is CompositeExpr)) return ep0;
CompositeExpr ce = ep0 as CompositeExpr;
if (ce.Head == WellKnownSym.power && ce.Args[1] is WordSym && ce.Args[0] is ArrayExpr)
{
pr.matrixOperationResult = new CompositeExpr(ce.Args[1], new ArrayExpr((Array)(ce.Args[0] as ArrayExpr).Elts.Clone()));
return pr.matrixOperationResult;
}
int c = ce.Args.Length;
Expr[] newExprElts = new Expr[c];
for (int i = 0; i < c; i++)
newExprElts[i] = genMMA(ce.Args[i], null, "All", pr);
return new CompositeExpr(ce.Head, newExprElts);
}
Expr newExpr = new CompositeExpr(new WordSym(op), new ArrayExpr((Array)ep1.Elts.Clone()));
if (ep0.Equals(ep1) && op == "No Matrix Operation") return ep1;
else if (ep0.Equals(ep1) && op != "No Matrix Operation") return newExpr;
if (ep0 is CompositeExpr)
{
CompositeExpr ce = ep0 as CompositeExpr;
if (ce.Head == new LetterSym('⇒') || ce.Head == new LetterSym('→'))
{
if (ce.Args[0].Equals(ep1) || ce.Args[0] is CompositeExpr && (ce.Args[0] as CompositeExpr).Head == WellKnownSym.power &&
(ce.Args[0] as CompositeExpr).Args[0].Equals(ep1))
return op != "No Matrix Operation" ? newExpr : ep1;
else return genMMA(ce.Args[0], ep1, op, null);
}
else if (ce.Head == WellKnownSym.power && ce.Args[0] is ArrayExpr)
{
if (ce.Args[0].Equals(ep1))
return op != "No Matrix Operation" ? new CompositeExpr(new WordSym(op), ce.Args[0]) : ce.Args[0];
else if (!(ce.Args[1] is WordSym)) return ce;
else return (ce.Args[1] as WordSym).Word != "No Matrix Operation" ? new CompositeExpr(ce.Args[1], ce.Args[0]) : ce.Args[0];
}
int c = (ep0 as CompositeExpr).Args.Length;
Expr[] newExprElts = new Expr[c];
for (int i = 0; i < c; i++)
newExprElts[i] = genMMA((ep0 as CompositeExpr).Args[i], ep1, op, null);
return new CompositeExpr((ep0 as CompositeExpr).Head, newExprElts);
}
return ep0;
}