protected final void initStack() {
    IFAState initialState = patternFA.getInitialState();
    IFATransition transition =
        patternFA.getPreciseMatchTransition(initialState).get(root.getName());
    if (transition == null) {
      // the visitor stack will be empty and the result of hasNext() will be false
      return;
    }
    IFAState rootState = patternFA.getNextState(initialState, transition);
    IFAState initScopeState = scopeDFA.getNextState(scopeDFA.getInitialState(), root.getName());
    currentStateMatchInfo = new StateSingleMatchInfo(patternFA, rootState, initScopeState);
    visitorStack.push(new VisitorStackEntry(createChildrenIterator(root), 1));
    ancestorStack.add(new AncestorStackEntry(root, currentStateMatchInfo));
  }
This method must be invoked before iteration
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/tree/AbstractTreeVisitor.java