/** * Create a new filter that tests all flags in a set. * * @param a * set of flags to test. * @return filter that selects only commits with all flags in <code>a</code>. */ public static RevFilter hasAll(params RevFlag[] a) { RevFlagSet set = new RevFlagSet(); foreach (RevFlag flag in a) set.Add(flag); return new HasAll(set); }
/// <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)); }
public void testEmpty() { final RevFlagSet set = new RevFlagSet(); assertEquals(0, set.mask); assertEquals(0, set.size()); assertNotNull(set.iterator()); assertFalse(set.iterator().hasNext()); }
public void testEmpty() { var flagSet = new RevFlagSet(); Assert.AreEqual(0, flagSet.Mask); Assert.AreEqual(0, flagSet.Count); Assert.IsNotNull(flagSet.GetEnumerator()); Assert.IsFalse(flagSet.GetEnumerator().MoveNext()); }
public virtual void TestEmpty() { RevFlagSet set = new RevFlagSet(); NUnit.Framework.Assert.AreEqual(0, set.mask); NUnit.Framework.Assert.AreEqual(0, set.Count); NUnit.Framework.Assert.IsNotNull(set.Iterator()); NUnit.Framework.Assert.IsFalse(set.Iterator().HasNext()); }
/// <summary> /// Create a new filter that tests for a single flag. /// </summary> /// <param name="a">The flag to test.</param> /// <returns> /// Filter that selects only commits with flag <paramref name="a"/>. /// </returns> public static RevFilter has(RevFlag a) { var s = new RevFlagSet { a }; return(new HasAll(s)); }
/// <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); }
/// <summary>Create a new filter that tests for any flag in a set.</summary> /// <remarks>Create a new filter that tests for any flag in a set.</remarks> /// <param name="a">set of flags to test.</param> /// <returns>filter that selects only commits with any flag in <code>a</code>.</returns> public static RevFilter HasAnyFilter(params RevFlag[] a) { RevFlagSet set = new RevFlagSet(); foreach (RevFlag flag in a) { set.AddItem(flag); } return(new RevFlagFilter.HasAny(set)); }
/// <summary> /// Create a new filter that tests for any flag in a set. /// </summary> /// <param name="a">Set of flags to test. </param> /// <returns> /// Filter that selects only commits with any flag in <code>a</code>. /// </returns> public static RevFilter hasAny(params RevFlag[] a) { var set = new RevFlagSet(); foreach (RevFlag flag in a) { set.Add(flag); } return(new HasAny(set)); }
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); }
public void testAddTwo() { final RevFlag flag1 = rw.newFlag("flag_1"); final RevFlag flag2 = rw.newFlag("flag_2"); assertTrue((flag1.mask & flag2.mask) == 0); final RevFlagSet set = new RevFlagSet(); assertTrue(set.add(flag1)); assertTrue(set.add(flag2)); assertEquals(flag1.mask | flag2.mask, set.mask); assertEquals(2, set.size()); }
public void testEquals() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); var flagSet = new RevFlagSet(); Assert.IsTrue(flagSet.Add(flag1)); Assert.IsTrue(flagSet.Add(flag2)); Assert.IsTrue(new RevFlagSet(flagSet).Equals(flagSet)); Assert.IsTrue(new RevFlagSet(new[] { flag1, flag2 }).Equals(flagSet)); }
public virtual void testContains() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); var flagSet = new RevFlagSet { flag1 }; Assert.IsTrue(flagSet.Contains(flag1)); Assert.IsFalse(flagSet.Contains(flag2)); //Assert.IsFalse(flagSet.Contains("bob")); }
public void testAddRevFlagSet() { RevCommit a = Commit(); RevFlag flag1 = rw.newFlag("flag1"); RevFlag flag2 = rw.newFlag("flag2"); var s = new RevFlagSet { flag1, flag2 }; Assert.AreEqual(0, a.Flags); a.add(s); Assert.AreEqual(flag1.Mask | flag2.Mask, a.Flags); }
public void testAddTwo() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); Assert.IsTrue((flag1.Mask & flag2.Mask) == 0); var flagSet = new RevFlagSet(); Assert.IsTrue(flagSet.Add(flag1)); Assert.IsTrue(flagSet.Add(flag2)); Assert.AreEqual(flag1.Mask | flag2.Mask, flagSet.Mask); Assert.AreEqual(2, flagSet.Count); }
public void testHasAnyFlag() { RevCommit a = Commit(); RevFlag flag1 = rw.newFlag("flag1"); RevFlag flag2 = rw.newFlag("flag2"); var s = new RevFlagSet { flag1, flag2 }; Assert.IsFalse(a.hasAny(s)); a.Flags |= flag1.Mask; Assert.IsTrue(a.hasAny(s)); }
public virtual void testRemove() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); var flagSet = new RevFlagSet(); Assert.IsTrue(flagSet.Add(flag1)); Assert.IsTrue(flagSet.Add(flag2)); Assert.IsTrue(flagSet.Remove(flag1)); Assert.IsFalse(flagSet.Remove(flag1)); Assert.AreEqual(flag2.Mask, flagSet.Mask); Assert.IsFalse(flagSet.Contains(flag1)); }
public void testAddOne() { final String flagName = "flag"; final RevFlag flag = rw.newFlag(flagName); assertTrue(0 != flag.mask); assertSame(flagName, flag.name); final RevFlagSet set = new RevFlagSet(); assertTrue(set.add(flag)); assertFalse(set.add(flag)); assertEquals(flag.mask, set.mask); assertEquals(1, set.size()); final Iterator<RevFlag> i = set.iterator(); assertTrue(i.hasNext()); assertSame(flag, i.next()); assertFalse(i.hasNext()); }
public void testRemoveRevFlagSet() { RevCommit a = Commit(); RevFlag flag1 = rw.newFlag("flag1"); RevFlag flag2 = rw.newFlag("flag2"); RevFlag flag3 = rw.newFlag("flag3"); var s = new RevFlagSet { flag1, flag2 }; a.add(flag3); a.add(s); Assert.AreEqual(flag1.Mask | flag2.Mask | flag3.Mask, a.Flags); a.remove(s); Assert.AreEqual(flag3.Mask, a.Flags); }
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()); }
/// <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); refFilter = RefFilter.DEFAULT; }
public void testAddOne() { const string flagName = "flag"; RevFlag flag = rw.newFlag(flagName); Assert.IsTrue(0 != flag.Mask); Assert.AreSame(flagName, flag.Name); var flagSet = new RevFlagSet(); Assert.IsTrue(flagSet.Add(flag)); Assert.IsFalse(flagSet.Add(flag)); Assert.AreEqual(flag.Mask, flagSet.Mask); Assert.AreEqual(1, flagSet.Count); var i = flagSet.GetEnumerator(); Assert.IsTrue(i.MoveNext()); Assert.AreSame(flag, i.Current); Assert.IsFalse(i.MoveNext()); }
/// <summary> /// Create a new pack upload for an open repository. /// </summary> /// <param name="copyFrom">the source repository.</param> public UploadPack(Repository copyFrom) { _db = copyFrom; _walk = new RevWalk.RevWalk(_db); _walk.setRetainBody(false); ADVERTISED = _walk.newFlag("ADVERTISED"); WANT = _walk.newFlag("WANT"); PEER_HAS = _walk.newFlag("PEER_HAS"); COMMON = _walk.newFlag("COMMON"); _walk.carry(PEER_HAS); SAVE = new RevFlagSet { ADVERTISED, WANT, PEER_HAS }; _refFilter = RefFilterContants.DEFAULT; }
public void testContainsAll() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); var set1 = new RevFlagSet(); Assert.IsTrue(set1.Add(flag1)); Assert.IsTrue(set1.Add(flag2)); Assert.IsTrue(set1.ContainsAll(set1)); Assert.IsTrue(set1.ContainsAll(new[] { flag1, flag2 })); var set2 = new RevFlagSet { rw.newFlag("flag_3") }; Assert.IsFalse(set1.ContainsAll(set2)); }
/// <summary> /// Create a new pack upload for an open repository. /// </summary> /// <param name="copyFrom">the source repository.</param> public UploadPack(Repository copyFrom) { _options = new List <string>(); _wantAll = new List <RevObject>(); _wantCommits = new List <RevCommit>(); _commonBase = new List <RevObject>(); _db = copyFrom; _walk = new RevWalk.RevWalk(_db); _walk.setRetainBody(false); ADVERTISED = _walk.newFlag("ADVERTISED"); WANT = _walk.newFlag("WANT"); PEER_HAS = _walk.newFlag("PEER_HAS"); COMMON = _walk.newFlag("COMMON"); _walk.carry(PEER_HAS); SAVE = new RevFlagSet { ADVERTISED, WANT, PEER_HAS }; }
public virtual void testContains() { RevFlag flag1 = rw.newFlag("flag_1"); RevFlag flag2 = rw.newFlag("flag_2"); var flagSet = new RevFlagSet {flag1}; Assert.IsTrue(flagSet.Contains(flag1)); Assert.IsFalse(flagSet.Contains(flag2)); //Assert.IsFalse(flagSet.Contains("bob")); }
public HasAll(RevFlagSet m) : base(m) { }
/// <summary> /// Add a set of flags to this object. /// </summary> /// <param name="set"> /// The set of flags to mark on this object, for later testing. /// </param> public void add(RevFlagSet set) { Flags |= set.Mask; }
/// <summary> /// Test to see if all flags in the set have been set on this object. /// </summary> /// <param name="set">the flags to test.</param> /// <returns>true if all flags of the set have been added to this object; /// false if some or none have been added. /// </returns> public bool hasAll(RevFlagSet set) { return (Flags & set.Mask) == set.Mask; }
public UploadPack(Repository copyFrom) { db = copyFrom; walk = new RevWalk.RevWalk(db); ADVERTISED = walk.newFlag("ADVERTISED"); WANT = walk.newFlag("WANT"); PEER_HAS = walk.newFlag("PEER_HAS"); COMMON = walk.newFlag("COMMON"); walk.carry(PEER_HAS); SAVE = new RevFlagSet(); SAVE.Add(ADVERTISED); SAVE.Add(WANT); SAVE.Add(PEER_HAS); }
internal RevFlagFilter(RevFlagSet m) { flags = m; }
internal HasAny(RevFlagSet m) : base(m) { }
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)); }
/// <summary> /// Create a new filter that tests all flags in a set. /// </summary> /// <param name="a">Set of flags to test.</param> /// <returns> filter that selects only commits with all flags in <paramref name="a"/>. /// </returns> public static RevFilter hasAll(RevFlagSet a) { return(new HasAll(new RevFlagSet(a))); }
/// <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(RevFlagSet a) { return(new RevFlagFilter.HasAll(new RevFlagSet(a))); }
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)); }
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")); }
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)); }
internal HasAll(RevFlagSet m) : base(m) { }
/// <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); }
/// <summary> /// Test to see if any flag in the set has been set on this object. /// </summary> /// <param name="set">the flags to test.</param> /// <returns> /// true if any flag in the set has been added to this object; false /// if not. /// </returns> public bool hasAny(RevFlagSet set) { return (Flags & set.Mask) != 0; }
/// <summary> /// Remove a set of flags from this object. /// </summary> /// <param name="set"> /// The flag to remove from this object. /// </param> public void remove(RevFlagSet set) { Flags &= ~set.Mask; }
/** * Add a set of flags to this object. * * @param set * the set of flags to mark on this object, for later testing. */ public void add(RevFlagSet set) { flags |= set.mask; }