本文整理汇总了C#中Term.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Term.Equals方法的具体用法?C# Term.Equals怎么用?C# Term.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.Equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualsTestEquality
public void EqualsTestEquality()
{
Term o1 = new Term("foo");
Term o2 = new Term("foo");
Assert.IsTrue(o1.Equals(o2));
}
示例2: TermCompare
protected internal override bool TermCompare(Term term)
{
if (term.Equals(singleTerm))
{
return true;
}
else
{
_endEnum = true;
return false;
}
}
示例3: UnifyTerm
private static bool UnifyTerm(Term x, Term y, Substitution theta)
{
if (x.Equals(y))
return true;
if (x is TermVariable)
{
if (!UnifyVariable((TermVariable)x, y, theta))
return false;
}
else if (y is TermVariable)
{
if (!UnifyVariable((TermVariable)y, x, theta))
return false;
}
else if ((x is TermFunction) && (y is TermFunction))
{
var xFunction = (TermFunction)x;
var yFunction = (TermFunction)y;
if (xFunction.FunctionName != yFunction.FunctionName)
return false;
for (int i = 0; i < xFunction.Arity; i++)
{
if (!UnifyTerm(xFunction.GetTerm(i), yFunction.GetTerm(i), theta))
return false;
}
}
else
{
return false;
}
return true;
}
示例4: EqualsTestInequality
public void EqualsTestInequality()
{
Term o1 = new Term("foo");
Term o2 = new Term("bar");
Assert.IsFalse(o1.Equals(o2));
}
示例5: EqualsTestReferenceEquals
public void EqualsTestReferenceEquals()
{
Term o1 = new Term("foo");
Term o2 = o1;
Assert.IsTrue(o1.Equals(o2));
}
示例6: EqualsTestObjectReferenceEquality
public void EqualsTestObjectReferenceEquality()
{
Term o1 = new Term("foo");
Object o2 = (Object) new Term("foo");
Assert.IsTrue(o1.Equals(o2));
}
示例7: Evaluate
/// <summary>
/// Evaluates the specified Terms.
/// </summary>
/// <param name="subject">The subject.</param>
/// <param name="obj">The obj.</param>
/// <returns>bool</returns>
public bool Evaluate(Term subject, Term obj)
{
return subject.Equals(obj);
}