Пример #1
0
  public Selector removeAppenders(Selector selector) {
    selector = replaceLeadingAppendersByEmptiness(selector);
    if (!selector.containsAppender()) return selector;

    Selector replacement = replaceMiddleAppendersByEmptiness(selector);
    return replacement;
  }
Пример #2
0
  public List<Selector> replaceAppenders(Selector inSelector, List<Selector> replacements) {
    if (!inSelector.containsAppender()) {
      return indirectJoinAll(replacements, null, inSelector);
    }

    List<Selector> result = Arrays.asList(inSelector);
    while (result.get(0).containsAppender()) {
      List<Selector> nextRound = new ArrayList<Selector>();
      for (Selector tbch : result) {
        nextRound.addAll(replaceFirstAppender(tbch, replacements));
      }

      result = nextRound;
    }

    return result;
  }