logback-android/src/main/java/ch/qos/logback/core/joran/spi/ElementSelector.java
public int getPrefixMatchLength(ElementPath p) {
    if (p == null) {
      return 0;
    }

    int lSize = this.partList.size();
    int rSize = p.partList.size();

    // no match possible for empty sets
    if ((lSize == 0) || (rSize == 0)) {
      return 0;
    }

    int minLen = (lSize <= rSize) ? lSize : rSize;
    int match = 0;

    for (int i = 0; i < minLen; i++) {
      String l = this.partList.get(i);
      String r = p.partList.get(i);

      if (equalityCheck(l, r)) {
        match++;
      } else {
        break;
      }
    }

    return match;
  }
public int getPrefixMatchLength(ElementPath p) {
    if (p == null) {
      return 0;
    }

    int lSize = this.partList.size();
    int rSize = p.partList.size();

    // no match possible for empty sets
    if ((lSize == 0) || (rSize == 0)) {
      return 0;
    }

    int minLen = (lSize <= rSize) ? lSize : rSize;
    int match = 0;

    for (int i = 0; i < minLen; i++) {
      String l = this.partList.get(i);
      String r = p.partList.get(i);

      if (equalityCheck(l, r)) {
        match++;
      } else {
        break;
      }
    }

    return match;
  }
Returns the number of "prefix" components that this pattern has in common
with the pattern p passed as parameter. By "prefix" components we mean the
components at the beginning of the pattern.
@param p element path
@return the number of "prefix" components in common with p