public void Visit(BracketNode node) { if (node.ChildNodes[0].Token.TokenType == TokenType.Not) { node.ChildNodes[0].Accept(this); return; } INode current = node; while (current.ChildNodes[0].Token.TokenType == TokenType.Concatenation) { current = node.ChildNodes[0]; } var nodes = new LiteralNodeCollection(); foreach (var expandedNode in Expand(current)) { if (nodes.Contains(expandedNode) == false) { nodes.Add(expandedNode); } } var index = RandomNumberProvider.GetRandomNumber(0, nodes.Count); nodes[index].Accept(this); }
public void Visit(NotNode node) { var nodes = new LiteralNodeCollection(); for (var i = 32; i < 126; i++) { nodes.Add(NodeBuilder.BuildLiteralNode(TokenBuilder.BuildLiteralToken((char)i))); } INode current = node; while (current.ChildNodes[0].Token.TokenType == TokenType.Concatenation) { current = node.ChildNodes[0]; } foreach (var expandedNode in Expand(current)) { if (nodes.Contains(expandedNode)) { nodes.Remove(expandedNode); } } var index = RandomNumberProvider.GetRandomNumber(0, nodes.Count); nodes[index].Accept(this); }