// instance methods

        #region public void Push(NumberingGroupType type, string prefix, string postfix, bool concatenate)

        public void Push(ListNumberingGroupStyle type, string prefix, string postfix, bool concatenate)
        {
            PDFListNumberingGroup group = new PDFListNumberingGroup(1, type, concatenate);

            group.PostFix = postfix;
            group.Prefix  = prefix;
            this.Push(group);
        }
        /// <summary>
        /// Pushes the specified group onto the stack
        /// </summary>
        /// <param name="grp"></param>
        public void Push(PDFListNumberingGroup grp)
        {
            if (null == grp)
            {
                throw new ArgumentNullException("grp");
            }

            this._items.Add(grp);
        }
        /// <summary>
        /// Pops the current group from the stack and returns it.
        /// </summary>
        /// <returns></returns>
        public PDFListNumberingGroup Pop()
        {
            if (this._items.Count == 0)
            {
                throw new IndexOutOfRangeException();
            }

            PDFListNumberingGroup grp = this.Current;

            this._items.RemoveAt(this.Count - 1);

            return(grp);
        }
        /// <summary>
        /// Takes the existing numbering groups in this stack and increments the last one.
        /// Returns a full string of the last group along with any (contiguously) concatenated values from higher in the stack
        /// </summary>
        /// <returns></returns>
        public string Increment()
        {
            if (this.Count == 0)
            {
                return(string.Empty);
            }


            //Get the highest group that is concatenated
            int index = this.Count - 1;

            while (index >= 0)
            {
                if (_items[index].ConcatenateWithParent == false)
                {
                    break;
                }
                else if (index == 0)
                {
                    break;
                }
                else
                {
                    index--;
                }
            }

            if (index < 0)
            {
                return(string.Empty);
            }

            //Concatenate all the values together
            StringBuilder sb = new StringBuilder();

            for (int depth = index; depth < this.Count; depth++)
            {
                PDFListNumberingGroup curr = this._items[depth];
                if (depth == this.Count - 1)
                {
                    curr.Increment();
                }

                string value = curr.ToString(depth);
                if (null != value)
                {
                    sb.Append(value);
                }
            }
            return(sb.ToString());
        }