public void Visit( RowRecogExprNode node, RowRecogExprNode optionalParent, int level) { var atom = node as RowRecogExprNodeAtom; if (atom?.OptionalRepeat != null) { if (_atoms == null) { _atoms = new List<Pair<RowRecogExprNodeAtom, RowRecogExprNode>>(); } _atoms.Add(new Pair<RowRecogExprNodeAtom, RowRecogExprNode>(atom, optionalParent)); } var nested = node as RowRecogExprNodeNested; if (nested?.OptionalRepeat != null) { if (_nesteds == null) { _nesteds = new List<RowRegexNestedDesc>(); } _nesteds.Add(new RowRegexNestedDesc(nested, optionalParent, level)); } if (node is RowRecogExprNodePermute) { var permute = (RowRecogExprNodePermute) node; if (_permutes == null) { _permutes = new List<RowRegexPermuteDesc>(); } _permutes.Add(new RowRegexPermuteDesc(permute, optionalParent, level)); } }
public RowRegexPermuteDesc( RowRecogExprNodePermute permute, RowRecogExprNode optionalParent, int level) { Permute = permute; OptionalParent = optionalParent; Level = level; }
public RowRegexNestedDesc( RowRecogExprNodeNested nested, RowRecogExprNode optionalParent, int level) { Nested = nested; OptionalParent = optionalParent; Level = level; }
public void AcceptChildnodes( RowRecogExprNodeVisitor visitor, RowRecogExprNode parent, int level) { visitor.Visit(this, parent, level); foreach (var childNode in ChildNodes) { childNode.AcceptChildnodes(visitor, this, level + 1); } }
public void ReplaceChildNode( RowRecogExprNode nodeToReplace, IList<RowRecogExprNode> replacementNodes) { IList<RowRecogExprNode> newChildNodes = new List<RowRecogExprNode>(ChildNodes.Count - 1 + replacementNodes.Count); foreach (var node in ChildNodes) { if (node != nodeToReplace) { newChildNodes.Add(node); } else { newChildNodes.AddAll(replacementNodes); } } ChildNodes = newChildNodes; }
/// <summary> /// Adds a child node. /// </summary> /// <param name="childNode">is the child evaluation tree node to add</param> public void AddChildNode(RowRecogExprNode childNode) { ChildNodes.Add(childNode); }