private static void AddPatternsListToComposer(IEnumerable <int> patternSeq)
        {
            var patternList = patternSeq.ToArray();

            var size = patternList.Max().LastOneBitPosition() + 1;

            Composer.IncreaseIndentation()
            .AppendLine(
                patternList
                .Select(i => $"{i.ToString().PadRight(3)} ({i.PatternToString(size)})")
                .Concatenate(Environment.NewLine)
                )
            .DecreaseIndentation();
        }
Esempio n. 2
0
        private void SectionsTreeToText(LinearComposer log)
        {
            log.Append(SectionName);

            if (IsLeaf)
            {
                return;
            }

            log.AppendLine(" {");
            log.IncreaseIndentation();

            var flag = true;

            foreach (var lowerSection in ChildSections)
            {
                if (flag)
                {
                    flag = false;
                }
                else
                {
                    log.AppendLine(",");
                }

                lowerSection.SectionsTreeToText(log);
            }

            log.DecreaseIndentation();
            log.AppendLine("}");
        }
Esempio n. 3
0
        public override void ToTextTree(LinearComposer log)
        {
            log.AppendLine("{");

            log.IncreaseIndentation();

            var flag = false;

            foreach (var pair in _chidNodesDictionary)
            {
                if (flag)
                {
                    log.Append(", ");
                }
                else
                {
                    flag = true;
                }

                log.Append(Key + " : ");
                pair.Value.ToTextTree(log);
            }

            log.DecreaseIndentation();

            log.AppendAtNewLine("}");
        }
        public override void ToString(LinearComposer textBuilder)
        {
            textBuilder.AppendLine("{");
            textBuilder.IncreaseIndentation();

            var flag = false;

            foreach (var pair in _nodes)
            {
                if (flag)
                {
                    textBuilder.AppendLine(",");
                }
                else
                {
                    flag = true;
                }

                textBuilder.Append(pair.Key.ToString());
                pair.Value.ToString(textBuilder);
            }

            textBuilder.DecreaseIndentation();
            textBuilder.AppendAtNewLine("}");
        }
Esempio n. 5
0
        public override void ToString(LinearComposer textBuilder)
        {
            textBuilder.Append("{");
            textBuilder.IncreaseIndentation();

            foreach (var item in _branches)
            {
                item.ToString(textBuilder);
            }

            textBuilder.DecreaseIndentation();
            textBuilder.AppendAtNewLine("}");
        }