Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeTree" /> class. Every symbol in the tree 'root' must be strictly less than 'symbolLimit'.
        /// </summary>
        /// <param name="root">The root.</param>
        /// <param name="symbolLimit">The symbol limit.</param>
        public CodeTree(InternalNode root, int symbolLimit)
        {
            if (root == null)
            {
                throw new Exception("Argument is null");
            }

            this.Root = root;

            this.codes = new List <List <int> >(); // Initially all null
            for (var i = 0; i < symbolLimit; i++)
            {
                this.codes.Add(null);
            }

            this.BuildCodeList(root, new List <int>()); // Fills 'codes' with appropriate data
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeTree" /> class. Every symbol in the tree 'root' must be strictly less than 'symbolLimit'.
        /// </summary>
        /// <param name="root">The root.</param>
        /// <param name="symbolLimit">The symbol limit.</param>
        public CodeTree(InternalNode root, int symbolLimit)
        {
            if (root == null)
            {
                throw new Exception("Argument is null");
            }

            this.Root = root;

            this.codes = new List<List<int>>(); // Initially all null
            for (var i = 0; i < symbolLimit; i++)
            {
                this.codes.Add(null);
            }

            this.BuildCodeList(root, new List<int>()); // Fills 'codes' with appropriate data
        }