public List<IDeviceID> getAllDevicePatterns() {
    final List<String> nodes = new ArrayList<>();
    final Set<List<String>> resultNodesSet = new HashSet<>();
    searchDevicePath(root, nodes, resultNodesSet);

    final Set<IDeviceID> resultPaths = new HashSet<>();
    for (final List<String> resultNodes : resultNodesSet) {
      if (resultNodes != null && !resultNodes.isEmpty()) {
        resultPaths.add(
            IDeviceID.Factory.DEFAULT_FACTORY.create(
                StringArrayDeviceID.splitDeviceIdString(resultNodes.toArray(new String[0]))));
      }
    }

    return new ArrayList<>(resultPaths);
  }
Construct tree according to the pathPatternList.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java