public static Evaluator createEvaluator(String text){
  if (isNumeric(text)) {
    return new IndexEvaluator(text);
  }
 else   if (text.startsWith("@")) {
    return new AttributeEvaluator(text);
  }
 else   if (text.indexOf(IndexEvaluator.FUNC_LAST) != -1) {
    return new IndexEvaluator(text);
  }
 else   if (text.indexOf(TextEvaluator.FUNC_TEXT) != -1) {
    return new TextEvaluator(text);
  }
 else   if (text.indexOf(IndexEvaluator.FUNC_POSITION) != -1) {
    return new IndexEvaluator(text);
  }
 else   if (text.startsWith("@")) {
    return new AttributeEvaluator(text);
  }
 else   if (text.indexOf('%') != -1) {
    return new ContainsEvaluator(text);
  }
 else   if (text.indexOf('=') != -1) {
    return new TextEvaluator(text);
  }
  throw new IllegalStateException("Could not create a comparator for value: " + text);
}

public static Evaluator createEvaluator ( String text ) { if ( isNumeric ( text ) ) { return new IndexEvaluator ( text ) ; } else if ( text . startsWith ( "@" ) ) { return new AttributeEvaluator ( text ) ; } else if ( text . indexOf ( IndexEvaluator . FUNC_LAST ) != - 1 ) { return new IndexEvaluator ( text ) ; } else if ( text . indexOf ( TextEvaluator . FUNC_TEXT ) != - 1 ) { return new TextEvaluator ( text ) ; } else if ( text . indexOf ( IndexEvaluator . FUNC_POSITION ) != - 1 ) { return new IndexEvaluator ( text ) ; } else if ( text . startsWith ( "@" ) ) { return new AttributeEvaluator ( text ) ; } else if ( text . indexOf ( '%' ) != - 1 ) { return new ContainsEvaluator ( text ) ; } else if ( text . indexOf ( '=' ) != - 1 ) { return new TextEvaluator ( text ) ; } throw new IllegalStateException ( "Could not create a comparator for value: " + text ) ; }
construct an evaluator for a given predicate expression .
