/** * Creates a StringMatcher for the given regular expression, which can * be a list of optionally negated simple entries. * <p> * An empty list results in a StringMatcher that matches any string. */ public StringMatcher parse(List regularExpressions) { StringMatcher listMatcher = null; // Loop over all simple regular expressions, backward, creating a // linked list of matchers. for (int index = regularExpressions.size()-1; index >= 0; index--) { String regularExpression = (String)regularExpressions.get(index); StringMatcher entryMatcher = parseEntry(regularExpression); // Prepend the entry matcher. listMatcher = listMatcher == null ? (StringMatcher)entryMatcher : isNegated(regularExpression) ? (StringMatcher)new AndMatcher(entryMatcher, listMatcher) : (StringMatcher)new OrMatcher(entryMatcher, listMatcher); } return listMatcher != null ? listMatcher : new ConstantMatcher(true); }
/** * Creates a StringMatcher for the given regular expression, which can * be a list of optionally negated simple entries. * <p> * An empty list results in a StringMatcher that matches any string. */ public StringMatcher parse(List regularExpressions) { StringMatcher listMatcher = null; // Loop over all simple regular expressions, backward, creating a // linked list of matchers. for (int index = regularExpressions.size()-1; index >=0; index--) { String regularExpression = (String)regularExpressions.get(index); StringMatcher entryMatcher = parseEntry(regularExpression); // Prepend the entry matcher. listMatcher = listMatcher == null ? (StringMatcher)entryMatcher : isNegated(regularExpression) ? (StringMatcher)new AndMatcher(entryMatcher, listMatcher) : (StringMatcher)new OrMatcher(entryMatcher, listMatcher); } return listMatcher != null ? listMatcher : new ConstantMatcher(true); }
/** * Creates a StringMatcher for the given regular expression, which can * be a list of optionally negated simple entries. * <p> * An empty list results in a StringMatcher that matches any string. */ public StringMatcher parse(List regularExpressions) { StringMatcher listMatcher = null; // Loop over all simple regular expressions, backward, creating a // linked list of matchers. for (int index = regularExpressions.size()-1; index >= 0; index--) { String regularExpression = (String)regularExpressions.get(index); StringMatcher entryMatcher = parseEntry(regularExpression); // Prepend the entry matcher. listMatcher = listMatcher == null ? (StringMatcher)entryMatcher : isNegated(regularExpression) ? (StringMatcher)new AndMatcher(entryMatcher, listMatcher) : (StringMatcher)new OrMatcher(entryMatcher, listMatcher); } return listMatcher != null ? listMatcher : new ConstantMatcher(true); }
/** * Creates a StringMatcher for the given regular expression, which can * be a list of optionally negated simple entries. * <p> * An empty list results in a StringMatcher that matches any string. */ public StringMatcher parse(List regularExpressions) { StringMatcher listMatcher = null; // Loop over all simple regular expressions, backward, creating a // linked list of matchers. for (int index = regularExpressions.size()-1; index >= 0; index--) { String regularExpression = (String)regularExpressions.get(index); StringMatcher entryMatcher = parseEntry(regularExpression); // Prepend the entry matcher. listMatcher = listMatcher == null ? (StringMatcher)entryMatcher : isNegated(regularExpression) ? (StringMatcher)new AndMatcher(entryMatcher, listMatcher) : (StringMatcher)new OrMatcher(entryMatcher, listMatcher); } return listMatcher != null ? listMatcher : new ConstantMatcher(true); }