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


C# Spreadsheet.GetNamesOfAllNonemptyCells方法代码示例

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


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

示例1: GetNamesOfAllNonemptyCellsTest3

 public void GetNamesOfAllNonemptyCellsTest3()
 {
     Spreadsheet test_spreadsheet = new Spreadsheet();
     test_spreadsheet.SetCellContents("A1", "x+1");
     Assert.AreEqual("A1", new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells())[0]);
     Assert.AreEqual(1, new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells()).Count);
 }
开发者ID:Buck417,项目名称:First-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs

示例2: TestEmptyGetNamesOfCells

 public void TestEmptyGetNamesOfCells()
 {
     Spreadsheet sheet = new Spreadsheet();
     var nameEnum = sheet.GetNamesOfAllNonemptyCells().GetEnumerator();
     nameEnum.MoveNext();
     Assert.IsTrue(nameEnum.Current == null);
 }
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:7,代码来源:UnitTest1.cs

示例3: RunRandomizedTest

 public void RunRandomizedTest(int seed, int size)
 {
     Spreadsheet s = new Spreadsheet();
     Random rand = new Random(seed);
     for (int i = 0; i < 10000; i++)
     {
         try
         {
             switch (rand.Next(3))
             {
                 case 0:
                     s.SetContentsOfCell(randomName(rand), "3.14");
                     break;
                 case 1:
                     s.SetContentsOfCell(randomName(rand), "hello");
                     break;
                 case 2:
                     s.SetContentsOfCell(randomName(rand), randomFormula(rand));
                     break;
             }
         }
         catch (CircularException)
         {
         }
     }
     ISet<string> set = new HashSet<string>(s.GetNamesOfAllNonemptyCells());
     Assert.AreEqual(size, set.Count);
 }
开发者ID:drewmacmac,项目名称:old_class,代码行数:28,代码来源:UnitTest1.cs

示例4: Form1

        /// <summary>
        /// Constructor for a Spreadsheet Form created from a file
        /// </summary>
        /// <param name="filename">The name of the file given</param>
        public Form1(string filename)
        {
            InitializeComponent();
            ss = new Spreadsheet(filename, Validator, UppercaseString, version);
            updateTextBox(spreadsheetPanel1);

            //Make sure all the existing cells show up
            foreach (string name in ss.GetNamesOfAllNonemptyCells())
            {
                updateCellValue(name);
            }
        }
开发者ID:Buck417,项目名称:Second-Half-CS-3500,代码行数:16,代码来源:Form1.cs

示例5: openToolStripMenuItem_Click

        /// <summary>
        /// Handle 'Open' from File Menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "sprd files (*.sprd)|*.sprd|All files (*.*)|*.*";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // get hashset of old spreadsheet so that we can add to it and erase old and set new cells
                HashSet<string> oldSpread = new HashSet<string> (model.GetNamesOfAllNonemptyCells());

                model = new Spreadsheet(openFileDialog1.FileName, s => Regex.IsMatch(s, @"[A-Z][1-9][0-9]?"), s => s.ToUpper(), "PS6");
                foreach (string cell in model.GetNamesOfAllNonemptyCells())
                {
                    oldSpread.Add(cell);
                }
                refresh(oldSpread);
            }          
        }
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:23,代码来源:Form1.cs

示例6: SSGUI

        //A constructor that takes a file path and attempts to construct a spreadsheet from it. Things may still go wrong.
        public SSGUI(string file)
        {
            InitializeComponent();

            //The validity and normalization functions
            Func<string, bool> isValid = delegate(string s)
            { return Regex.IsMatch(s, @"[a-zA-Z][1-9][0-9]?"); };
            Func<string, string> normalize = delegate(string s)
            { return s.ToUpper(); };

            //Link with actual spread sheet
            _sheet = new Spreadsheet(file, isValid, normalize, "ps6");

            //Set the filepath to the file the spreadsheet opened
            filepath = file;

            //Loads the values into panel
            LoadPanelValues(new HashSet<string>(_sheet.GetNamesOfAllNonemptyCells()));

            //Display the first selection correctly.
            DisplaySelection(SSPanel);
        }
开发者ID:jam98,项目名称:Spreadsheet,代码行数:23,代码来源:SpreadsheetGUI.cs

示例7: TestGetNamesOfNonEmptyCells

        public void TestGetNamesOfNonEmptyCells()
        {
            Spreadsheet sheet = new Spreadsheet();
            sheet.SetCellContents("A1", 10.5);
            sheet.SetCellContents("B1", "horse");
            sheet.SetCellContents("E1", 1.5);
            sheet.SetCellContents("A", "dad");

            var nameEnum = sheet.GetNamesOfAllNonemptyCells().GetEnumerator();

            List<object> names = new List<object>();
            for (int i = 0; i < 4; i++)
            {
                nameEnum.MoveNext();
                names.Add(nameEnum.Current);
            }
            
            Assert.IsTrue(names.Count == 4);

            Assert.IsTrue(names.Contains("A1"));
            Assert.IsTrue(names.Contains("B1"));
            Assert.IsTrue(names.Contains("E1"));
            Assert.IsTrue(names.Contains("A"));
        }
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:24,代码来源:UnitTest1.cs

示例8: TestGetNamesOfAllNonemptyCells1

 public void TestGetNamesOfAllNonemptyCells1()
 {
     Spreadsheet sheet = new Spreadsheet();
     sheet.SetContentsOfCell("a1", "0.0");
     HashSet<string> correct = new HashSet<string> { "a1" };
     HashSet<string> output = (HashSet<string>)sheet.GetNamesOfAllNonemptyCells();
     Assert.IsTrue(correct.SetEquals(output));
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:8,代码来源:MyUnitTests.cs

示例9: Test23

 public void Test23()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("A1", 17.2);
     s.SetCellContents("C1", "hello");
     s.SetCellContents("B1", new Formula("3.5"));
     Assert.IsTrue(new HashSet<string>(s.GetNamesOfAllNonemptyCells()).SetEquals(new HashSet<string>() { "A1", "B1", "C1" }));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:8,代码来源:PS4_GradingTests.cs

示例10: GetNamesOfAllNonemptyCellsTest5

        public void GetNamesOfAllNonemptyCellsTest5()
        {
            Spreadsheet test_spreadsheet = new Spreadsheet();
            HashSet<String> set = new HashSet<string>();
            set.Add("A1");
            set.Add("B2");
            set.Add("C3");
            test_spreadsheet.SetCellContents("A1", new Formula("1+a1"));
            test_spreadsheet.SetCellContents("B2", new Formula("a1*a1"));
            test_spreadsheet.SetCellContents("C3", 5);
            IEnumerable<string> real_set;
            real_set = test_spreadsheet.GetNamesOfAllNonemptyCells();

            foreach (String s in real_set)
                Assert.IsTrue(set.Contains(s));
        }
开发者ID:Buck417,项目名称:First-Half-CS-3500,代码行数:16,代码来源:SpreadsheetTests.cs

示例11: TestAddingEmptyCell

        public void TestAddingEmptyCell()
        {
            Spreadsheet sheet = new Spreadsheet();
            sheet.SetCellContents("A1", new Formula("D1"));
            sheet.SetCellContents("B1", "purple");
            sheet.SetCellContents("C1", 4);

            sheet.SetCellContents("A1", "");
            sheet.SetCellContents("B1", "");
            sheet.SetCellContents("C1", "");

            Assert.IsFalse(sheet.GetNamesOfAllNonemptyCells().GetEnumerator().MoveNext());
        }
开发者ID:drewmacmac,项目名称:old_class,代码行数:13,代码来源:UnitTest1.cs

示例12: TestRead3

 public void TestRead3()
 {
     string path = "read3.xml";
     Spreadsheet sheet = new Spreadsheet();
     sheet.SetContentsOfCell("a1", "=1.5+4");
     sheet.SetContentsOfCell("b2", "=a2-2.6");
     sheet.SetContentsOfCell("c3", "=3.7*e5");
     sheet.SetContentsOfCell("d4", "hil");
     sheet.SetContentsOfCell("e5", "5.9");
     sheet.Save(path);
     HashSet<string> original = (HashSet<string>)sheet.GetNamesOfAllNonemptyCells();
     Spreadsheet sheet2 = new Spreadsheet(path, x => true, s => s, "default");
     foreach (string s in original) {
         Assert.IsTrue(sheet.GetCellContents(s).Equals(sheet2.GetCellContents(s)));
         Assert.IsTrue(sheet.GetCellValue(s).Equals(sheet2.GetCellValue(s)));
     }
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:17,代码来源:MyUnitTests.cs

示例13: Test1900

 public void Test1900()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetContentsOfCell("B1", "");
     Assert.IsFalse(s.GetNamesOfAllNonemptyCells().GetEnumerator().MoveNext());
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:6,代码来源:MyUnitTests.cs

示例14: Stress5

 public void Stress5()
 {
     int seed = 47;
     int size = 831;
     AbstractSpreadsheet s = new Spreadsheet();
     Random rand = new Random(seed);
     for (int i = 0; i < 1000; i++)
     {
         try
         {
             switch (rand.Next(3))
             {
                 case 0:
                     s.SetContentsOfCell(randomName(rand), "3.14");
                     break;
                 case 1:
                     s.SetContentsOfCell(randomName(rand), "hello");
                     break;
                 case 2:
                     s.SetContentsOfCell(randomName(rand), "=" + randomFormula(rand));
                     break;
             }
         }
         catch (CircularException)
         {
         }
     }
     ISet<string> set = new HashSet<string>(s.GetNamesOfAllNonemptyCells());
     //return size == set.Count;
     Assert.AreEqual(size, set.Count);
 }
开发者ID:UofU-CS3500-S16,项目名称:spreadsheet,代码行数:31,代码来源:GradingTests.cs

示例15: Test2300

 public void Test2300()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetContentsOfCell("A1", "17.2");
     s.SetContentsOfCell("C1", "hello");
     s.SetContentsOfCell("B1", "=3.5");
     Assert.IsTrue(new HashSet<string>(s.GetNamesOfAllNonemptyCells()).SetEquals(new HashSet<string>() { "A1", "B1", "C1" }));
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:8,代码来源:MyUnitTests.cs


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