private SinglePathPatternNode getNextNode(final SinglePathPatternNode currentNode) {
    if (currentNode.patternIndex == pathPattern.getNodeLength()) {
      return currentNode;
    }
    final String[] rawNodes = pathPattern.getNodes();
    int nextIndex = currentNode.getIndex() + 1;
    if (patternNodes[nextIndex] == null) {
      if (nextIndex == rawNodes.length) {
        patternNodes[nextIndex] = new PrefixMatchNode(nextIndex, currentNode.getTracebackNode());
      } else if (rawNodes[nextIndex] == null) {
        patternNodes[nextIndex] = new NameMatchNode(nextIndex, currentNode.getTracebackNode());
      } else if (rawNodes[nextIndex].equals(MULTI_LEVEL_PATH_WILDCARD)) {
        patternNodes[nextIndex] = new MultiLevelWildcardMatchNode(nextIndex);
      } else if (rawNodes[nextIndex].equals(ONE_LEVEL_PATH_WILDCARD)) {
        patternNodes[nextIndex] =
            new OneLevelWildcardMatchNode(
                nextIndex,
                currentNode.getTracebackNode(),
                pathPattern instanceof ExtendedPartialPath
                    ? event -> ((ExtendedPartialPath) pathPattern).match(nextIndex, event)
                    : event -> true);
      } else if (PathPatternUtil.hasWildcard(rawNodes[nextIndex])) {
        patternNodes[nextIndex] = new RegexMatchNode(nextIndex, currentNode.getTracebackNode());
      } else {
        patternNodes[nextIndex] = new NameMatchNode(nextIndex, currentNode.getTracebackNode());
      }
    }
    return patternNodes[nextIndex];
  }
Given path pattern root.sg.*.s, the SimpleNFA is:

<p>initial -(root)-> state[0] -(sg)-> state[1] -(*)-> state[2] -(s)-> state[3] <br>
state[3] is final state

<p>Given path pattern root.**.s, the SimpleNFA is:

<p>initial -(root)-> state[0] -(*)-> state[1] -(s)-> state[2] <br>
with extra: state[1] -(*)-> state[1] and state[2] -(*)-> state[1] <br>
state[3] is final state

<p>Given path pattern root.sg.d with prefix match, the SimpleNFA is:

<p>initial -(root)-> state[0] -(sg)-> state[1] -(d)-> state[2] -(*)-> state[3] <br>
with extra: state[3] -(*)-> state[3] <br>
both state[2] and state[3] are final states
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/fa/nfa/SimpleNFA.java