本文整理汇总了C#中AList.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# AList.Contains方法的具体用法?C# AList.Contains怎么用?C# AList.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AList
的用法示例。
在下文中一共展示了AList.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogAllCommits
public virtual void LogAllCommits()
{
IList<RevCommit> commits = new AList<RevCommit>();
Git git = Git.Wrap(db);
WriteTrashFile("Test.txt", "Hello world");
git.Add().AddFilepattern("Test.txt").Call();
commits.AddItem(git.Commit().SetMessage("initial commit").Call());
git.BranchCreate().SetName("branch1").Call();
Ref checkedOut = git.Checkout().SetName("branch1").Call();
NUnit.Framework.Assert.AreEqual("refs/heads/branch1", checkedOut.GetName());
WriteTrashFile("Test1.txt", "Hello world!");
git.Add().AddFilepattern("Test1.txt").Call();
commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
checkedOut = git.Checkout().SetName("master").Call();
NUnit.Framework.Assert.AreEqual("refs/heads/master", checkedOut.GetName());
WriteTrashFile("Test2.txt", "Hello world!!");
git.Add().AddFilepattern("Test2.txt").Call();
commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
Iterator<RevCommit> log = git.Log().All().Call().Iterator();
NUnit.Framework.Assert.IsTrue(log.HasNext());
NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
NUnit.Framework.Assert.IsTrue(log.HasNext());
NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
NUnit.Framework.Assert.IsTrue(log.HasNext());
NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
NUnit.Framework.Assert.IsFalse(log.HasNext());
}
示例2: GetPv
/// <summary>
/// Gets the principal variation and the best move from the transposition
/// table
/// </summary>
private void GetPv()
{
StringBuilder sb = new StringBuilder();
IList<long> keys = new AList<long>();
// To not repeat keys
int i = 0;
while (i < 256)
{
if (tt.Search(board, false))
{
if (keys.Contains(board.GetKey()))
{
break;
}
keys.AddItem(board.GetKey());
if (tt.GetBestMove() == 0)
{
break;
}
if (i == 0)
{
globalBestMove = tt.GetBestMove();
}
else
{
if (i == 1)
{
ponderMove = tt.GetBestMove();
}
}
sb.Append(Move.ToString(tt.GetBestMove()));
sb.Append(" ");
i++;
board.DoMove(tt.GetBestMove(), false);
}
else
{
break;
}
}
// Now undo moves
for (int j = 0; j < i; j++)
{
board.UndoMove();
}
pv = sb.ToString();
}