private Filter<Object> parseCondition(CharSequenceScanner scanner) {

    int index = scanner.getCurrentIndex();
    Filter<Object> condition;
    if (scanner.expect(CONDITION_VAR)) {
      // variable choice
      String symbol = scanner.readWhile(FILTER_COMPARATOR);
      CompareOperator comparator = CompareOperator.fromValue(symbol);
      if (comparator == null) {
        throw new IllegalArgumentException(symbol);
      }
      Object comparatorArgument = parseComparatorArgument(scanner);
      condition = new Condition(comparator, comparatorArgument);
    } else if (scanner.expect(CONDITION_ELSE, false)) {
      condition = FILTER_ELSE;
    } else {
      throw new IllegalArgumentException(scanner.substring(index, scanner.getCurrentIndex()));
    }
    if (!scanner.expect(CONDITION_END)) {
      throw new IllegalArgumentException(scanner.substring(index, scanner.getCurrentIndex()));
    }
    return condition;
  }
private Filter < Object > parseCondition ( CharSequenceScanner scanner ) { int index = scanner . getCurrentIndex ( ) ; Filter < Object > condition ; if ( scanner . expect ( CONDITION_VAR ) ) { String symbol = scanner . readWhile ( FILTER_COMPARATOR ) ; CompareOperator comparator = CompareOperator . fromValue ( symbol ) ; if ( comparator == null ) { throw new IllegalArgumentException ( symbol ) ; } Object comparatorArgument = parseComparatorArgument ( scanner ) ; condition = new Condition ( comparator , comparatorArgument ) ; } else if ( scanner . expect ( CONDITION_ELSE , false ) ) { condition = FILTER_ELSE ; } else { throw new IllegalArgumentException ( scanner . substring ( index , scanner . getCurrentIndex ( ) ) ) ; } if ( ! scanner . expect ( CONDITION_END ) ) { throw new IllegalArgumentException ( scanner . substring ( index , scanner . getCurrentIndex ( ) ) ) ; } return condition ; }
This method parses the {@link Condition}.

@param scanner is the {@link CharSequenceScanner}.
@return the parsed {@link Condition} or {@link #FILTER_ELSE} in case of {@link #CONDITION_ELSE}.