System.Text.RegularExpressions.RegexNode.Reduce C# (CSharp) Method

Reduce() private method

Removes redundant nodes from the subtree, and returns a reduced subtree.
private Reduce ( ) : RegexNode
return RegexNode
        internal RegexNode Reduce()
        {
            RegexNode n;

            switch (Type())
            {
                case Alternate:
                    n = ReduceAlternation();
                    break;

                case Concatenate:
                    n = ReduceConcatenation();
                    break;

                case Loop:
                case Lazyloop:
                    n = ReduceRep();
                    break;

                case Group:
                    n = ReduceGroup();
                    break;

                case Set:
                case Setloop:
                    n = ReduceSet();
                    break;

                default:
                    n = this;
                    break;
            }

            return n;
        }

Usage Example

        internal void AddChild(RegexNode newChild)
        {
            if (this._children == null)
            {
                this._children = new ArrayList();
            }
            RegexNode node = newChild.Reduce();

            this._children.Add(node);
            node._next = this;
        }
All Usage Examples Of System.Text.RegularExpressions.RegexNode::Reduce