public void SetAtValidInputs()
        {
            singleWordCountModel.SetAt(2, 11);
            int x = singleWordCountModel.GetAt(2);

            Assert.AreEqual(x, 11);
        }
Esempio n. 2
0
        /// <summary>
        /// Recalculate this group's counts.
        /// </summary>
        private void CalculateFingerprint()
        {
            //Reset counts.
            for (int i = 0; i < _length; i++)
            {
                _counts.SetAt(i, 0);
            }
            //Check to see if this group has any texts or child groups as items.
            //If not, all counts can stay at zero.
            if (_items.Count == 0)
            {
                return;
            }
            //get count totals
            foreach (ITextOrGroupModel item in _items)
            {
                var itemCounts = item.GetCounts();
                for (int i = 0; i < _length; i++)
                {
                    _counts.SetAt(i, _counts.GetAt(i) + itemCounts.GetAt(i));
                }
            }
            //divide by number of items to get averages
            int numberOfItems = _items.Count;

            for (int i = 0; i < _length; i++)
            {
                _counts.SetAt(i, _counts.GetAt(i) / numberOfItems);
            }
        }
Esempio n. 3
0
 public void SetAt(bool includeQuotes, int index, int value)
 {
     if (index < 0 || index >= _length)
     {
         throw new IndexOutOfRangeException();
     }
     if (value < 0)
     {
         throw new ArgumentException("Counts must not be negative.");
     }
     if (includeQuotes)
     {
         _countsWithQuotes.SetAt(index, value);
     }
     else
     {
         _countsWithoutQuotes.SetAt(index, value);
     }
 }
Esempio n. 4
0
        private ISingleWordCountModel TranslateCounts(WordCount count)
        {
            ISingleWordCountModel output = _modelFactory.GetSingleCountModel(UniversalConstants.CountSize);

            output.SetAt(0, (int)count.One);
            output.SetAt(1, (int)count.Two);
            output.SetAt(2, (int)count.Three);
            output.SetAt(3, (int)count.Four);
            output.SetAt(4, (int)count.Five);
            output.SetAt(5, (int)count.Six);
            output.SetAt(6, (int)count.Seven);
            output.SetAt(7, (int)count.Eight);
            output.SetAt(8, (int)count.Nine);
            output.SetAt(9, (int)count.Ten);
            output.SetAt(10, (int)count.Eleven);
            output.SetAt(11, (int)count.Twelve);
            output.SetAt(12, (int)count.Thirteen);
            return(output);
        }