當前位置: 首頁>>代碼示例>>C#>>正文


C# DependencyGraph.RemoveDependency方法代碼示例

本文整理匯總了C#中SpreadsheetUtilities.DependencyGraph.RemoveDependency方法的典型用法代碼示例。如果您正苦於以下問題:C# DependencyGraph.RemoveDependency方法的具體用法?C# DependencyGraph.RemoveDependency怎麽用?C# DependencyGraph.RemoveDependency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SpreadsheetUtilities.DependencyGraph的用法示例。


在下文中一共展示了DependencyGraph.RemoveDependency方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: EmptyTest11

 public void EmptyTest11()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     Assert.AreEqual(t.Size, 1);
     t.RemoveDependency("x", "y");
     t.RemoveDependency("x", "y");
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:8,代碼來源:GradingTests.cs

示例2: EmptyTest10

 public void EmptyTest10()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     Assert.AreEqual(1, t["y"]);
     t.RemoveDependency("x", "y");
     Assert.AreEqual(0, t["y"]);
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:8,代碼來源:GradingTests.cs

示例3: EmptyTest12

 public void EmptyTest12()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     Assert.AreEqual(t.Size, 1);
     t.RemoveDependency("x", "y");
     t.ReplaceDependents("x", new HashSet<string>());
     t.ReplaceDependees("y", new HashSet<string>());
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:9,代碼來源:GradingTests.cs

示例4: AddTest1Test

 public void AddTest1Test()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("A1", "A2");
     t.AddDependency("A1", "A3");
     t.RemoveDependency("A1", "A2");
     Assert.AreEqual(1, t.Size);
     t.AddDependency("A1", "A4");
     Assert.AreEqual(2, t.Size);
     HashSet<string> test = new HashSet<string>();
     test.Add("A3");
     test.Add("A4");
     Assert.AreEqual(true, test.SetEquals(t.GetDependents("A1")));
 }
開發者ID:Buck417,項目名稱:Second-Half-CS-3500,代碼行數:14,代碼來源:SpreadsheetUtilitiesTest.cs

示例5: MyTest3

        public void MyTest3()
        {
            DependencyGraph t = new DependencyGraph();
            t.AddDependency("a", "b");
            t.AddDependency("b", "c");
            t.AddDependency("b", "d");
            t.AddDependency("c", "d");
            t.RemoveDependency("b", "c");
            t.ReplaceDependents("b", new HashSet<string>() {"c"});
            Assert.AreEqual(3, t.Size);

        }
開發者ID:Buck417,項目名稱:First-Half-CS-3500,代碼行數:12,代碼來源:UnitTest1.cs

示例6: NonEmptyTest15

        public void NonEmptyTest15()
        {
            DependencyGraph t = new DependencyGraph();
            t.AddDependency("x", "y");
            t.AddDependency("a", "b");
            t.AddDependency("a", "c");
            t.AddDependency("a", "d");
            t.AddDependency("c", "b");
            t.RemoveDependency("a", "d");
            t.AddDependency("e", "b");
            t.AddDependency("b", "d");
            t.RemoveDependency("e", "b");
            t.RemoveDependency("x", "y");

            IEnumerator<string> e = t.GetDependents("a").GetEnumerator();
            Assert.IsTrue(e.MoveNext());
            String s1 = e.Current;
            Assert.IsTrue(e.MoveNext());
            String s2 = e.Current;
            Assert.IsFalse(e.MoveNext());
            Assert.IsTrue(((s1 == "b") && (s2 == "c")) || ((s1 == "c") && (s2 == "b")));

            e = t.GetDependents("b").GetEnumerator();
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual("d", e.Current);
            Assert.IsFalse(e.MoveNext());

            e = t.GetDependents("c").GetEnumerator();
            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual("b", e.Current);
            Assert.IsFalse(e.MoveNext());

            e = t.GetDependents("d").GetEnumerator();
            Assert.IsFalse(e.MoveNext());
        }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:35,代碼來源:GradingTests.cs

示例7: NonEmptyTest13

 public void NonEmptyTest13()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     t.AddDependency("a", "b");
     t.AddDependency("a", "c");
     t.AddDependency("a", "d");
     t.AddDependency("c", "b");
     t.RemoveDependency("a", "d");
     t.AddDependency("e", "b");
     t.AddDependency("b", "d");
     t.RemoveDependency("e", "b");
     t.RemoveDependency("x", "y");
     Assert.IsTrue(t.HasDependents("a"));
     Assert.IsFalse(t.HasDependees("a"));
     Assert.IsTrue(t.HasDependents("b"));
     Assert.IsTrue(t.HasDependees("b"));
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:18,代碼來源:GradingTests.cs

示例8: NonEmptyTest12

 public void NonEmptyTest12()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     t.AddDependency("a", "b");
     t.AddDependency("a", "c");
     t.AddDependency("a", "d");
     t.AddDependency("c", "b");
     t.RemoveDependency("a", "d");
     t.AddDependency("e", "b");
     t.AddDependency("b", "d");
     t.RemoveDependency("e", "b");
     t.RemoveDependency("x", "y");
     Assert.AreEqual(2, t["b"]);
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:15,代碼來源:GradingTests.cs

示例9: EmptyTest9

 public void EmptyTest9()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     IEnumerator<string> e1 = t.GetDependees("y").GetEnumerator();
     Assert.IsTrue(e1.MoveNext());
     Assert.AreEqual("x", e1.Current);
     IEnumerator<string> e2 = t.GetDependents("x").GetEnumerator();
     Assert.IsTrue(e2.MoveNext());
     Assert.AreEqual("y", e2.Current);
     t.RemoveDependency("x", "y");
     Assert.IsFalse(t.GetDependees("y").GetEnumerator().MoveNext());
     Assert.IsFalse(t.GetDependents("x").GetEnumerator().MoveNext());
 }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:14,代碼來源:GradingTests.cs

示例10: MyStressTest1

        public void MyStressTest1()
        {
            // Dependency graph
            DependencyGraph t = new DependencyGraph();
            Random rd = new Random();

            for (int i = 65; i < 95; i++ )
            {
                for(int j = 0; j< 10000; j++)
                {
                    string s1 = "" + (char)i +""+ j;
                    string s2 = "" + (char)(i+1) +""+ (j+1);
                    t.AddDependency(s1, s2);
                }
            }

            Assert.AreEqual(300000, t.Size);

            for (int i = 65; i < 95; i++)
            {
                for (int j = 0; j < 10000; j++)
                {
                    string s1 = "" + (char)i + "" + j;
                    string s2 = "" + (char)(i + 1) + "" + (j + 1);
                    t.RemoveDependency(s1, s2);
                }
            }
            Assert.AreEqual(0, t.Size);


        }
開發者ID:jimibue,項目名稱:cs3505,代碼行數:31,代碼來源:UnitTest1.cs

示例11: StressTest15

        public void StressTest15()
        {
            // Dependency graph
            DependencyGraph t = new DependencyGraph();

            // A bunch of strings to use
            const int SIZE = 100;
            string[] letters = new string[SIZE];
            for (int i = 0; i < SIZE; i++)
            {
                letters[i] = ("" + (char)('a' + i));
            }

            // The correct answers
            HashSet<string>[] dents = new HashSet<string>[SIZE];
            HashSet<string>[] dees = new HashSet<string>[SIZE];
            for (int i = 0; i < SIZE; i++)
            {
                dents[i] = new HashSet<string>();
                dees[i] = new HashSet<string>();
            }

            // Add a bunch of dependencies
            for (int i = 0; i < SIZE; i++)
            {
                for (int j = i + 1; j < SIZE; j++)
                {
                    t.AddDependency(letters[i], letters[j]);
                    dents[i].Add(letters[j]);
                    dees[j].Add(letters[i]);
                }
            }

            // Remove a bunch of dependencies
            for (int i = 0; i < SIZE; i++)
            {
                for (int j = i + 2; j < SIZE; j += 2)
                {
                    t.RemoveDependency(letters[i], letters[j]);
                    dents[i].Remove(letters[j]);
                    dees[j].Remove(letters[i]);
                }
            }

            // Replace a bunch of dependees
            for (int i = 0; i < SIZE; i += 4)
            {
                HashSet<string> newDees = new HashSet<String>();
                for (int j = 0; j < SIZE; j += 7)
                {
                    newDees.Add(letters[j]);
                }
                t.ReplaceDependees(letters[i], newDees);

                foreach (string s in dees[i])
                {
                    dents[s[0] - 'a'].Remove(letters[i]);
                }

                foreach (string s in newDees)
                {
                    dents[s[0] - 'a'].Add(letters[i]);
                }

                dees[i] = newDees;
            }

            // Make sure everything is right
            for (int i = 0; i < SIZE; i++)
            {
                Assert.IsTrue(dents[i].SetEquals(new HashSet<string>(t.GetDependents(letters[i]))));
                Assert.IsTrue(dees[i].SetEquals(new HashSet<string>(t.GetDependees(letters[i]))));
            }
        }
開發者ID:jimibue,項目名稱:cs3505,代碼行數:74,代碼來源:DevelopmentTests.cs

示例12: StressTest1

        public void StressTest1()
        {
            // Dependency graph
            DependencyGraph t = new DependencyGraph();

            // A bunch of strings to use
            const int SIZE = 200;
            string[] letters = new string[SIZE];
            for (int i = 0; i < SIZE; i++)
            {
                letters[i] = ("" + (char)('a' + i));
            }

            // The correct answers
            HashSet<string>[] dents = new HashSet<string>[SIZE];
            HashSet<string>[] dees = new HashSet<string>[SIZE];
            for (int i = 0; i < SIZE; i++)
            {
                dents[i] = new HashSet<string>();
                dees[i] = new HashSet<string>();
            }

            // Add a bunch of dependencies
            for (int i = 0; i < SIZE; i++)
            {
                for (int j = i + 1; j < SIZE; j++)
                {
                    t.AddDependency(letters[i], letters[j]);
                    dents[i].Add(letters[j]);
                    dees[j].Add(letters[i]);
                }
            }

            // Remove a bunch of dependencies
            for (int i = 0; i < SIZE; i++)
            {
                for (int j = i + 4; j < SIZE; j += 4)
                {
                    t.RemoveDependency(letters[i], letters[j]);
                    dents[i].Remove(letters[j]);
                    dees[j].Remove(letters[i]);
                }
            }

            // Add some back
            for (int i = 0; i < SIZE; i++)
            {
                for (int j = i + 1; j < SIZE; j += 2)
                {
                    t.AddDependency(letters[i], letters[j]);
                    dents[i].Add(letters[j]);
                    dees[j].Add(letters[i]);
                }
            }

            // Remove some more
            for (int i = 0; i < SIZE; i += 2)
            {
                for (int j = i + 3; j < SIZE; j += 3)
                {
                    t.RemoveDependency(letters[i], letters[j]);
                    dents[i].Remove(letters[j]);
                    dees[j].Remove(letters[i]);
                }
            }

            // Make sure everything is right
            for (int i = 0; i < SIZE; i++)
            {
                Assert.IsTrue(dents[i].SetEquals(new HashSet<string>(t.GetDependents(letters[i]))));
                Assert.IsTrue(dees[i].SetEquals(new HashSet<string>(t.GetDependees(letters[i]))));
            }
        }
開發者ID:Leyalic,項目名稱:PS6_2015,代碼行數:73,代碼來源:GradingTests.cs

示例13: mytest6

        public void mytest6()
        {
            DependencyGraph t = new DependencyGraph();
            t.AddDependency("a", "b");
            t.AddDependency("a", "c");
            t.AddDependency("d", "c");
            t.RemoveDependency("a", "b");
            t.RemoveDependency("a", "c");
            //t.RemoveDependency("c", "c");

            Assert.AreEqual(1, t.Size);
        }
開發者ID:GabeKenworthy,項目名稱:Software-Practice-I,代碼行數:12,代碼來源:UnitTest1.cs

示例14: MyTest2

        public void MyTest2()
        {
            DependencyGraph t = new DependencyGraph();
            t.AddDependency("a", "b");
            t.AddDependency("b", "c");
            t.AddDependency("c", "d");
            t.AddDependency("d", "e");
            t.RemoveDependency("b", "c");
            t.RemoveDependency("c", "d");
            Assert.AreEqual(2, t.Size);

        }
開發者ID:Buck417,項目名稱:First-Half-CS-3500,代碼行數:12,代碼來源:UnitTest1.cs

示例15: NonEmptyTest21

 public void NonEmptyTest21()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("x", "y");
     t.AddDependency("a", "b");
     t.AddDependency("a", "c");
     t.AddDependency("a", "d");
     t.AddDependency("c", "b");
     t.RemoveDependency("a", "d");
     t.AddDependency("e", "b");
     t.AddDependency("b", "d");
     t.RemoveDependency("e", "b");
     t.RemoveDependency("x", "y");
     Assert.AreEqual(4, t.Size);
 }
開發者ID:Buck417,項目名稱:First-Half-CS-3500,代碼行數:15,代碼來源:UnitTest1.cs


注:本文中的SpreadsheetUtilities.DependencyGraph.RemoveDependency方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。