• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apache / iotdb / #9875

21 Aug 2023 01:06AM UTC coverage: 47.992% (-0.001%) from 47.993%
#9875

push

travis_ci

web-flow
Implement intersect with prefix pattern for PartialPath and PathPatternTree (#10909)

71 of 71 new or added lines in 3 files covered. (100.0%)

79843 of 166368 relevant lines covered (47.99%)

0.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTreeUtils.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19

20
package org.apache.iotdb.commons.path;
21

22
public class PathPatternTreeUtils {
×
23
  /**
24
   * Intersect the pattern tree with the full path prefix tree, and return the intersected pattern
25
   * tree.
26
   *
27
   * @param patternTree any pattern tree
28
   * @param fullPathPrefixTree the included pattern must be fullPath or prefix pattern(e.g.
29
   *     root.sg.**)
30
   * @return the intersected pattern tree
31
   */
32
  public static PathPatternTree intersectWithFullPathPrefixTree(
33
      PathPatternTree patternTree, PathPatternTree fullPathPrefixTree) {
34
    PathPatternTree result = new PathPatternTree();
1✔
35
    for (PartialPath pathPattern : patternTree.getAllPathPatterns()) {
1✔
36
      for (PartialPath fullPathOrPrefix : fullPathPrefixTree.getAllPathPatterns()) {
1✔
37
        if (fullPathOrPrefix.endWithMultiLevelWildcard()) {
1✔
38
          // prefix
39
          for (PartialPath temp : pathPattern.intersectWithPrefixPattern(fullPathOrPrefix)) {
1✔
40
            result.appendPathPattern(temp);
1✔
41
          }
1✔
42
        } else {
43
          // full path
44
          if (pathPattern.matchFullPath(fullPathOrPrefix)) {
1✔
45
            result.appendPathPattern(fullPathOrPrefix);
1✔
46
          }
47
        }
48
      }
1✔
49
    }
1✔
50
    result.constructTree();
1✔
51
    return result;
1✔
52
  }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc