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


C# SpreadsheetUtilities.DependencyGraph類代碼示例

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


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

示例1: Spreadsheet

 /// <summary>
 /// 
 /// </summary>
 /// <param name="isValid"></param>
 /// <param name="normalize"></param>
 /// <param name="version"></param>
 public Spreadsheet (Func<string, bool> isValid, Func<string, string> normalize, string version) 
     : base(isValid, normalize, version)
 {
     allCells = new Dictionary<string, Cell>();
     graph = new DependencyGraph();
     isChanged = false;
 }
開發者ID:HeroOfCanton,項目名稱:CS3500,代碼行數:13,代碼來源:spreadsheet.cs

示例2: Spreadsheet

 /// <summary>
 /// Constructor which takes in delegate values from the user
 /// </summary>
 /// <param name="isValid">Validity delegate</param>
 /// <param name="normalize">Normalization delegate</param>
 /// <param name="version">Version of spreadsheet</param>
 public Spreadsheet(Func<string, bool> isValid, Func<string, string> normalize, string version)
     : base(isValid, normalize, version)
 {
     dependency_graph = new DependencyGraph();
     cell = new Dictionary<String, Cell>();
     Changed = false;            //Test
 }
開發者ID:Buck417,項目名稱:Second-Half-CS-3500,代碼行數:13,代碼來源:Spreadsheet.cs

示例3: Spreadsheet

 /// <summary>
 /// Contructs a new spreadsheet, (4 arguments from user)
 /// </summary>
 public Spreadsheet(string path, Func<string, bool> isValid, Func<string, string> normalize, string version)
     : base(isValid, normalize, version)
 {
     cells = new Dictionary<string, Cell>();
     dependencyGraph = new DependencyGraph();
     GetSavedVersion(path);
 }
開發者ID:hodgeskyjon,項目名稱:3505_Spring_Project,代碼行數:10,代碼來源:Spreadsheet.cs

示例4: AddTest2Test

 public void AddTest2Test()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("A3", "A2");
     t.AddDependency("A1", "A2");
     Assert.AreEqual(2, t.Size);
 }
開發者ID:Buck417,項目名稱:Second-Half-CS-3500,代碼行數:7,代碼來源:SpreadsheetUtilitiesTest.cs

示例5: Spreadsheet

 /// <summary>
 /// Reads a saved spreadsheet from file and uses it to construct a new spreadsheet. 
 /// The spreadsheet uses the provided validity delegate, normalization delegate and verson. 
 /// </summary>
 /// <param name="file"></param>
 /// <param name="isValid"></param>
 /// <param name="normalize"></param>
 /// <param name="version"></param>
 public Spreadsheet(string file, Func<string, bool> isValid, Func<string, string> normalize, string version)
     : base(isValid, normalize, version)
 {
     spreadsheet = new Dictionary<string, Cell>();
     dependencyGraph = new DependencyGraph();
     ReadFile(file);
 }
開發者ID:amozoss,項目名稱:CS3505,代碼行數:15,代碼來源:Spreadsheet.cs

示例6: 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

示例7: 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

示例8: Spreadsheet

 public Spreadsheet()
     : base(s=>true, s => s, "default")
 {
     this.IsValid = IsValid;
     this.Normalize = Normalize;
     dg = new DependencyGraph();
     cells = new HashSet<Cell>();
     change = false;
 }
開發者ID:jfairbourn,項目名稱:Spreadsheet,代碼行數:9,代碼來源:Spreadsheet.cs

示例9: 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

示例10: 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

示例11: PrivateDataTest

 public void PrivateDataTest()
 {
     try
     {
         DependencyGraph dg = new DependencyGraph();
         dg.AddDependency("a", "b");
         dg.AddDependency("a", "c");
         ICollection<string> temp = (ICollection<string>)dg.GetDependents("a");
         temp.Add("d");
         Assert.IsTrue(new HashSet<string> { "b", "c", "d" }.SetEquals(temp));
         Assert.IsTrue(new HashSet<string> { "b", "c" }.SetEquals(dg.GetDependents("a")));
     }
     catch (Exception e)
     {
         if (!(e is NotSupportedException || e is InvalidCastException))
             Assert.Fail();
     }
 }
開發者ID:Buck417,項目名稱:Second-Half-CS-3500,代碼行數:18,代碼來源:SpreadsheetUtilitiesTest.cs

示例12: Spreadsheet

        /// <summary>
        /// Opens a saved spreadsheet and puts it back together
        /// </summary>
        /// <param name="myPath"></param>
        /// <param name="myValid"></param>
        /// <param name="myNormalize"></param>
        /// <param name="myVersion"></param>
        public Spreadsheet(string myPath, Func<string, bool> myValid, Func<string, string> myNormalize, string myVersion)
            : base(myValid, myNormalize, myVersion)
        {
            mySpreadsheet = new Dictionary<string, Cell>();
            dependentCells = new DependencyGraph();
            //GetSavedVersion(myPath);
            using (XmlReader myReader = XmlReader.Create(myPath))
            {
                string myContent = null;
                while (myReader.Read())
                {

                    if (myReader.IsStartElement())
                    {
                        switch (myReader.Name)
                        {
                            case "Version Information":
                                break;
                            case "cell":
                                break;

                            case "name":

                                myReader.Read();
                                myContent = myReader.Value;
                                break;
                            case "contents":
                                myReader.Read();
                                HashSet<string> mySet = new HashSet<string>();
                                //Foreach look sets the cell contents and evaluates the value of any direct or indirect dependents
                                foreach (string s in SetContentsOfCell(myContent, myReader.Value))
                                {
                                    mySpreadsheet[s].myValue = myEvaluate(s);
                                }
                                break;

                        }
                    }
                }
            }
            Changed = false;
        }
開發者ID:HyveMynd,項目名稱:CloudSpreadSheet,代碼行數:49,代碼來源:Spreadsheet.cs

示例13: Spreadsheet

        /// <summary>
        /// Constructs an abstract spreadsheet by recording its variable validity test,
        /// its normalization method, and its version information.  The variable validity
        /// test is used throughout to determine whether a string that consists of one or
        /// more letters followed by one or more digits is a valid cell name.  The variable
        /// equality test should be used thoughout to determine whether two variables are
        /// equal.
        /// </summary>
        public Spreadsheet(string filePath, Func<string, bool> isValid, Func<string, string> normalize, string version)
            : base(isValid, normalize, version)
        {
            //read save file from filePath
            spreadsheet = new Dictionary<string, Cell> { };
            dependency_graph = new DependencyGraph();
            has_changed = false;
            try
            {
                using (XmlReader read_file = XmlReader.Create(filePath))
                {
                    if (GetSavedVersion(filePath) != version)
                    {
                        throw new SpreadsheetReadWriteException("File versions are not the same.");
                    }
                    try
                    {
                        string cell_name = "";
                        while (read_file.Read())
                        {
                            if (read_file.IsStartElement())
                            {
                                switch (read_file.Name)
                                {
                                    case "spreadsheet":
                                        break;
                                    case "cell":
                                        break;
                                    case "name":
                                        read_file.Read();
                                        cell_name = read_file.Value;
                                        break;
                                    case "contents":
                                        read_file.Read();
                                        try
                                        {
                                            SetContentsOfCell(cell_name, read_file.Value);
                                        }
                                        catch (Exception ex)
                                        {
                                            throw new SpreadsheetReadWriteException(ex.Message);
                                        }
                                        break;
                                }
                            }
                        }
                    }
                    catch
                    {

                        throw new SpreadsheetReadWriteException("Error while reading from file");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new SpreadsheetReadWriteException(ex.Message);
            }
            has_changed = false;
        }
開發者ID:RyanJones0814,項目名稱:spreadsheet,代碼行數:68,代碼來源:Spreadsheet.cs

示例14: Spreadsheet

 /// <summary>
 /// The three argument constructor; this allows the user to provide a validity delegate, a normalization delegate, 
 /// and a version (third parameter).
 /// </summary>
 /// <param name="isValid"></param>
 /// <param name="normalize"></param>
 /// <param name="version"></param>
 public Spreadsheet(Func<string, bool> isValid, Func<string, string> normalize, string version)
     : base(isValid, normalize, version)
 {
     //Setup data structures that keep track of which cells depend on which, and the association between cells and cell names.
     dependencies = new DependencyGraph();
     cells = new SortedDictionary<string, Cell>();
     Changed = false;
 }
開發者ID:jam98,項目名稱:Spreadsheet,代碼行數:15,代碼來源:Spreadsheet.cs

示例15: EmptyTest8

 public void EmptyTest8()
 {
     DependencyGraph t = new DependencyGraph();
     t.AddDependency("a", "b");
 }
開發者ID:jimibue,項目名稱:cs3505,代碼行數:5,代碼來源:DevelopmentTests.cs


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