Пример #1
0
 private void CollectImplicitAnd(QCon constraint, IIndexedNodeWithRange x, IIndexedNodeWithRange
                                 y)
 {
     _nodes.Remove(x);
     _nodes.Remove(y);
     _nodes.Add(new AndIndexedLeaf(constraint, x, y));
 }
Пример #2
0
        public virtual void TestContainsAll()
        {
            Collection4TestCase.Item a  = new Collection4TestCase.Item(42);
            Collection4TestCase.Item b  = new Collection4TestCase.Item(a.id + 1);
            Collection4TestCase.Item c  = new Collection4TestCase.Item(b.id + 1);
            Collection4TestCase.Item a_ = new Collection4TestCase.Item(a.id);
            Collection4 needle          = new Collection4();
            Collection4 haystack        = new Collection4();

            haystack.Add(a);
            needle.Add(a);
            needle.Add(b);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Remove(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(b);
            haystack.Add(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(a_);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(c);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
            haystack.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
        }
Пример #3
0
        public virtual void TestContainsAll()
        {
            var a        = new Item(42);
            var b        = new Item(a.id + 1);
            var c        = new Item(b.id + 1);
            var a_       = new Item(a.id);
            var needle   = new Collection4();
            var haystack = new Collection4();

            haystack.Add(a);
            needle.Add(a);
            needle.Add(b);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Remove(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(b);
            haystack.Add(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(a_);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(c);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
            haystack.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
        }
 internal virtual void RemoveThread(ServerMessageDispatcherImpl dispatcher)
 {
     lock (_dispatchers)
     {
         _dispatchers.Remove(dispatcher);
         CheckCaresAboutCommitted();
     }
     TriggerClientDisconnected(dispatcher.Name);
 }
Пример #5
0
        public virtual void TestRemove()
        {
            Collection4 c = NewCollection(new string[] { "1", "2", "3", "4" });

            c.Remove("3");
            AssertCollection(new string[] { "1", "2", "4" }, c);
            c.Remove("4");
            AssertCollection(new string[] { "1", "2" }, c);
            c.Add("5");
            AssertCollection(new string[] { "1", "2", "5" }, c);
            c.Remove("1");
            AssertCollection(new string[] { "2", "5" }, c);
            c.Remove("2");
            c.Remove("5");
            AssertCollection(new string[] {  }, c);
            c.Add("6");
            AssertCollection(new string[] { "6" }, c);
        }
Пример #6
0
        private void AssertNotContainsNull(Collection4 c)
        {
            Assert.IsFalse(c.Contains(null));
            Assert.IsNull(c.Get(null));
            int size = c.Size();

            c.Ensure(null);
            Assert.AreEqual(size + 1, c.Size());
            c.Remove(null);
            Assert.AreEqual(size, c.Size());
        }
Пример #7
0
        public virtual void TestContains()
        {
            object      a = new object();
            Collection4 c = new Collection4();

            c.Add(new object());
            Assert.IsFalse(c.Contains(a));
            c.Add(a);
            Assert.IsTrue(c.Contains(a));
            c.Remove(a);
            Assert.IsFalse(c.Contains(a));
        }
        private void AssertAllItems(IEnumerator result)
        {
            Collection4 expected = Range(ItemCount);

            for (int i = 0; i < ItemCount; ++i)
            {
                ConcurrentLazyQueriesTestCase.Item nextItem = (ConcurrentLazyQueriesTestCase.Item
                                                               )IteratorPlatform.Next(result);
                expected.Remove(nextItem.id);
            }
            Assert.AreEqual("[]", expected.ToString());
        }
        private void AssertIterator(Hashtable4 table, object[] keys)
        {
            IEnumerator iter     = table.Iterator();
            Collection4 expected = new Collection4(keys);

            while (iter.MoveNext())
            {
                IEntry4 entry     = (IEntry4)iter.Current;
                bool    removedOK = expected.Remove(entry.Key());
                Assert.IsTrue(removedOK);
            }
            Assert.IsTrue(expected.IsEmpty(), expected.ToString());
        }
        public Collection4 ForInterface(IReflectClass claxx)
        {
            Collection4           col = new Collection4();
            ClassMetadataIterator i   = Iterator();

            while (i.MoveNext())
            {
                ClassMetadata clazz     = i.CurrentClass();
                IReflectClass candidate = clazz.ClassReflector();
                if (!candidate.IsInterface())
                {
                    if (claxx.IsAssignableFrom(candidate))
                    {
                        col.Add(clazz);
                        IEnumerator j = new Collection4(col).GetEnumerator();
                        while (j.MoveNext())
                        {
                            ClassMetadata existing = (ClassMetadata)j.Current;
                            if (existing != clazz)
                            {
                                ClassMetadata higher = clazz.GetHigherHierarchy(existing);
                                if (higher != null)
                                {
                                    if (higher == clazz)
                                    {
                                        col.Remove(existing);
                                    }
                                    else
                                    {
                                        col.Remove(clazz);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(col);
        }
Пример #11
0
        public virtual void TestNulls()
        {
            Collection4 c = new Collection4();

            c.Add("one");
            AssertNotContainsNull(c);
            c.Add(null);
            AssertContainsNull(c);
            AssertCollection(new string[] { "one", null }, c);
            c.Prepend(null);
            AssertCollection(new string[] { null, "one", null }, c);
            c.Prepend("zero");
            c.Add("two");
            AssertCollection(new string[] { "zero", null, "one", null, "two" }, c);
            AssertContainsNull(c);
            c.Remove(null);
            AssertCollection(new string[] { "zero", "one", null, "two" }, c);
            c.Remove(null);
            AssertNotContainsNull(c);
            AssertCollection(new string[] { "zero", "one", "two" }, c);
            c.Remove(null);
            AssertCollection(new string[] { "zero", "one", "two" }, c);
        }
Пример #12
0
        public static void SameContent(IEnumerator expected, IEnumerator actual)
        {
            Collection4 allExpected = new Collection4(expected);

            while (actual.MoveNext())
            {
                object current = actual.Current;
                bool   removed = allExpected.Remove(current);
                if (!removed)
                {
                    Unexpected(current);
                }
            }
            Assert.IsTrue(allExpected.IsEmpty(), "Still missing: " + allExpected.ToString());
        }
            private bool Expect(IObjectContainer container, string[] names)
            {
                Collection4 expected = new Collection4(names);
                IObjectSet  actual   = container.Query(typeof(CrashSimulatingTestSuite.CrashData));

                while (actual.HasNext())
                {
                    CrashSimulatingTestSuite.CrashData current = (CrashSimulatingTestSuite.CrashData)
                                                                 actual.Next();
                    if (!expected.Remove(current._name))
                    {
                        return(false);
                    }
                }
                return(expected.IsEmpty());
            }
Пример #14
0
        private void AssertEntries(PersistentEntry[] expected, IEnumerator actual)
        {
            Collection4 checklist = new Collection4(actual);

            Assert.AreEqual(expected.Length, checklist.Size());
            for (int i = 0; i < expected.Length; ++i)
            {
                PersistentEntry e = expected[i];
                PersistentEntry a = EntryByUid(checklist.GetEnumerator(), e.uid);
                if (a != null)
                {
                    AssertEqualEntries(e, a);
                    checklist.Remove(a);
                }
            }
            Assert.IsTrue(checklist.IsEmpty(), checklist.ToString());
        }
Пример #15
0
        public static void SameContent(IEnumerator expected, IEnumerator actual)
        {
            var allExpected = new Collection4();

            while (expected.MoveNext())
            {
                allExpected.Add(expected.Current);
            }
            while (actual.MoveNext())
            {
                var current = actual.Current;
                var removed = allExpected.Remove(current);
                if (!removed)
                {
                    Unexpected(current);
                }
            }
            Assert.IsTrue(allExpected.IsEmpty(), allExpected.ToString());
        }
Пример #16
0
 protected override void Process(FieldMetadata field)
 {
     Assert.IsNotNull(expectedNames.Remove(field.GetName()));
 }
Пример #17
0
 internal virtual void RemoveConstraint(QCon a_constraint)
 {
     i_constraints.Remove(a_constraint);
 }
Пример #18
0
 internal virtual void RemoveJoin(QConJoin a_join)
 {
     i_joins.Remove(a_join);
     CheckLastJoinRemoved();
 }
Пример #19
0
 public virtual void Remove(ObjectContainerBase container)
 {
     _containers.Remove(container);
 }