Esempio n. 1
0
        private void BuildDisplay(IBTreeNode node, int currentHeight, object parentId, bool withIds)
        {
            if (currentHeight > _lines.Length - 1)
            {
                return;
            }

            // get string buffer of this line
            var line = _lines[currentHeight];

            if (withIds)
            {
                line.Append(node.GetId()).Append(":[");
            }
            else
            {
                line.Append("[");
            }

            for (var i = 0; i < node.GetNbKeys(); i++)
            {
                if (i > 0)
                {
                    line.Append(" , ");
                }

                var keyAndValue = node.GetKeyAndValueAt(i);
                line.Append(keyAndValue.GetKey());
            }

            if (withIds)
            {
                line.Append("]:").Append(node.GetParentId()).Append("/").Append(parentId).Append("    ");
            }
            else
            {
                line.Append("]  ");
            }

            for (var i = 0; i < node.GetNbChildren(); i++)
            {
                var child = node.GetChildAt(i, false);

                if (child != null)
                {
                    BuildDisplay(child, currentHeight + 1, node.GetId(), withIds);
                }
                else
                {
                    _lines[currentHeight + 1].Append(string.Concat("[Child {0} null!] ", (i + 1).ToString()));
                }
            }
        }
Esempio n. 2
0
        private void BuildDisplay(IBTreeNode node, int currentHeight, object parentId, bool withIds)
        {
            if (currentHeight > _lines.Length - 1)
                return;

            // get string buffer of this line
            var line = _lines[currentHeight];
            if (withIds)
                line.Append(node.GetId()).Append(":[");
            else
                line.Append("[");

            for (var i = 0; i < node.GetNbKeys(); i++)
            {
                if (i > 0)
                    line.Append(" , ");

                var keyAndValue = node.GetKeyAndValueAt(i);
                line.Append(keyAndValue.GetKey());
            }

            if (withIds)
                line.Append("]:").Append(node.GetParentId()).Append("/").Append(parentId).Append("    ");
            else
                line.Append("]  ");

            for (var i = 0; i < node.GetNbChildren(); i++)
            {
                var child = node.GetChildAt(i, false);

                if (child != null)
                    BuildDisplay(child, currentHeight + 1, node.GetId(), withIds);
                else
                    _lines[currentHeight + 1].Append(string.Concat("[Child {0} null!] ", (i + 1).ToString()));
            }
        }