当前位置: 首页>>代码示例>>C#>>正文


C# RevFlagSet.AddItem方法代码示例

本文整理汇总了C#中RevFlagSet.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# RevFlagSet.AddItem方法的具体用法?C# RevFlagSet.AddItem怎么用?C# RevFlagSet.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RevFlagSet的用法示例。


在下文中一共展示了RevFlagSet.AddItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestAddOne

		public virtual void TestAddOne()
		{
			string flagName = "flag";
			RevFlag flag = rw.NewFlag(flagName);
			NUnit.Framework.Assert.IsTrue(0 != flag.mask);
			NUnit.Framework.Assert.AreSame(flagName, flag.name);
			RevFlagSet set = new RevFlagSet();
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag));
			NUnit.Framework.Assert.IsFalse(set.AddItem(flag));
			NUnit.Framework.Assert.AreEqual(flag.mask, set.mask);
			NUnit.Framework.Assert.AreEqual(1, set.Count);
			Iterator<RevFlag> i = set.Iterator();
			NUnit.Framework.Assert.IsTrue(i.HasNext());
			NUnit.Framework.Assert.AreSame(flag, i.Next());
			NUnit.Framework.Assert.IsFalse(i.HasNext());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:16,代码来源:RevFlagSetTest.cs

示例2: HasAllFilter

		/// <summary>Create a new filter that tests all flags in a set.</summary>
		/// <remarks>Create a new filter that tests all flags in a set.</remarks>
		/// <param name="a">set of flags to test.</param>
		/// <returns>filter that selects only commits with all flags in <code>a</code>.</returns>
		public static RevFilter HasAllFilter(params RevFlag[] a)
		{
			RevFlagSet set = new RevFlagSet();
			foreach (RevFlag flag in a)
			{
				set.AddItem(flag);
			}
			return new RevFlagFilter.HasAll(set);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:13,代码来源:RevFlagFilter.cs

示例3: UploadPack

		/// <summary>Create a new pack upload for an open repository.</summary>
		/// <remarks>Create a new pack upload for an open repository.</remarks>
		/// <param name="copyFrom">the source repository.</param>
		public UploadPack(Repository copyFrom)
		{
			db = copyFrom;
			walk = new RevWalk(db);
			walk.SetRetainBody(false);
			WANT = walk.NewFlag("WANT");
			PEER_HAS = walk.NewFlag("PEER_HAS");
			COMMON = walk.NewFlag("COMMON");
			SATISFIED = walk.NewFlag("SATISFIED");
			walk.Carry(PEER_HAS);
			SAVE = new RevFlagSet();
			SAVE.AddItem(WANT);
			SAVE.AddItem(PEER_HAS);
			SAVE.AddItem(COMMON);
			SAVE.AddItem(SATISFIED);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:19,代码来源:UploadPack.cs

示例4: TestContainsAll

		public virtual void TestContainsAll()
		{
			RevFlag flag1 = rw.NewFlag("flag_1");
			RevFlag flag2 = rw.NewFlag("flag_2");
			RevFlagSet set1 = new RevFlagSet();
			NUnit.Framework.Assert.IsTrue(set1.AddItem(flag1));
			NUnit.Framework.Assert.IsTrue(set1.AddItem(flag2));
			NUnit.Framework.Assert.IsTrue(set1.ContainsAll(set1));
			NUnit.Framework.Assert.IsTrue(set1.ContainsAll(Arrays.AsList(new RevFlag[] { flag1
				, flag2 })));
			RevFlagSet set2 = new RevFlagSet();
			set2.AddItem(rw.NewFlag("flag_3"));
			NUnit.Framework.Assert.IsFalse(set1.ContainsAll(set2));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:14,代码来源:RevFlagSetTest.cs

示例5: TestAddTwo

		public virtual void TestAddTwo()
		{
			RevFlag flag1 = rw.NewFlag("flag_1");
			RevFlag flag2 = rw.NewFlag("flag_2");
			NUnit.Framework.Assert.AreEqual(0, (flag1.mask & flag2.mask));
			RevFlagSet set = new RevFlagSet();
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
			NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask, set.mask);
			NUnit.Framework.Assert.AreEqual(2, set.Count);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:11,代码来源:RevFlagSetTest.cs

示例6: TestContains

		public virtual void TestContains()
		{
			RevFlag flag1 = rw.NewFlag("flag_1");
			RevFlag flag2 = rw.NewFlag("flag_2");
			RevFlagSet set = new RevFlagSet();
			set.AddItem(flag1);
			NUnit.Framework.Assert.IsTrue(set.Contains(flag1));
			NUnit.Framework.Assert.IsFalse(set.Contains(flag2));
			NUnit.Framework.Assert.IsFalse(set.Contains("bob"));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:RevFlagSetTest.cs

示例7: TestRemove

		public virtual void TestRemove()
		{
			RevFlag flag1 = rw.NewFlag("flag_1");
			RevFlag flag2 = rw.NewFlag("flag_2");
			RevFlagSet set = new RevFlagSet();
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
			NUnit.Framework.Assert.IsTrue(set.Remove(flag1));
			NUnit.Framework.Assert.IsFalse(set.Remove(flag1));
			NUnit.Framework.Assert.AreEqual(flag2.mask, set.mask);
			NUnit.Framework.Assert.IsFalse(set.Contains(flag1));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:12,代码来源:RevFlagSetTest.cs

示例8: TestEquals

		public virtual void TestEquals()
		{
			RevFlag flag1 = rw.NewFlag("flag_1");
			RevFlag flag2 = rw.NewFlag("flag_2");
			RevFlagSet set = new RevFlagSet();
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
			NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
			NUnit.Framework.Assert.AreEqual(set, new RevFlagSet(set));
			NUnit.Framework.Assert.IsTrue(new RevFlagSet(Arrays.AsList(new RevFlag[] { flag1, 
				flag2 })).Equals(set));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:11,代码来源:RevFlagSetTest.cs

示例9: Has

		/// <summary>Create a new filter that tests for a single flag.</summary>
		/// <remarks>Create a new filter that tests for a single flag.</remarks>
		/// <param name="a">the flag to test.</param>
		/// <returns>filter that selects only commits with flag <code>a</code>.</returns>
		public static RevFilter Has(RevFlag a)
		{
			RevFlagSet s = new RevFlagSet();
			s.AddItem(a);
			return new RevFlagFilter.HasAll(s);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:RevFlagFilter.cs

示例10: TestRemoveRevFlagSet

		public virtual void TestRemoveRevFlagSet()
		{
			RevCommit a = Commit();
			RevFlag flag1 = rw.NewFlag("flag1");
			RevFlag flag2 = rw.NewFlag("flag2");
			RevFlag flag3 = rw.NewFlag("flag3");
			RevFlagSet s = new RevFlagSet();
			s.AddItem(flag1);
			s.AddItem(flag2);
			a.Add(flag3);
			a.Add(s);
			NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask | flag3.mask, a.flags);
			a.Remove(s);
			NUnit.Framework.Assert.AreEqual(flag3.mask, a.flags);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:15,代码来源:RevObjectTest.cs

示例11: TestHasAllFlag

		public virtual void TestHasAllFlag()
		{
			RevCommit a = Commit();
			RevFlag flag1 = rw.NewFlag("flag1");
			RevFlag flag2 = rw.NewFlag("flag2");
			RevFlagSet s = new RevFlagSet();
			s.AddItem(flag1);
			s.AddItem(flag2);
			NUnit.Framework.Assert.IsFalse(a.HasAll(s));
			a.flags |= flag1.mask;
			NUnit.Framework.Assert.IsFalse(a.HasAll(s));
			a.flags |= flag2.mask;
			NUnit.Framework.Assert.IsTrue(a.HasAll(s));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:14,代码来源:RevObjectTest.cs


注:本文中的RevFlagSet.AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。