code: private int translateElementNo(int i) {
      if (!useList || i < 0) {
        return i;
      }
      int j = 0;
      PatternRule rule = (PatternRule) this.rule;
      for (int k = 0; k < i; k++) {
        j += rule.getElementNo().get(k);
      }
      return j;
    }
docs: Gets the index of the element indexed by i, adding any offsets because of
  the phrases in the rule.
  @param i Current element index.
  @return int Index translated into XML element no.