private void ResetPattern() { matchedStartIndex = 0; patternStartIndex = 0; patternStartNode = root; matchedStartNode = null; CurrentPattern.Clear(); for (var currentNode = root; currentNode != null; currentNode = currentNode.Next) { CurrentPattern.Add(currentNode.Value); } MinimizePattern(); }
/// <summary> /// Adds a new node to the current pattern and revalidates /// </summary> /// <returns> /// Returns true if pattern is matched fully and repetition is hit /// </returns> private bool AddToPattern(PatternStackNode <T> node) { CurrentPattern.Add(node.Value); if (patternStartNode == null) { patternStartNode = node; patternStartIndex = HeadIndex; } if (matchedStartNode != null) { if (CheckIfMatches()) { if (PatternFull()) { return(true); } return(false); } } if (FindMatch()) { if (PatternFull()) { return(true); } return(false); } if (MinimizePattern()) { if (PatternFull()) { return(true); } } return(false); }