/** * A map from pattern to value * @param values the pattern map to set */ public void setPatternMap(Map<String, T> values) { this.values = new PatternMatcher<T>(values); }
/** * Classify the input by matching it against the patterns provided in * {@link #setPatternMap(Map)}. The most specific pattern that matches will * be used to locate a value. * * @return the value matching the most specific pattern possible * * @throws IllegalStateException if no matching value is found. */ public T classify(String classifiable) { T value = values.match(classifiable); return value; }
/** * Create a classifier from the provided map. The keys are patterns, using * '?' as a single character and '*' as multi-character wildcard. * * @param values the values to use in the {@link PatternMatcher} */ public PatternMatchingClassifier(Map<String, T> values) { super(); this.values = new PatternMatcher<T>(values); }
if (PatternMatcher.match(key, line)) { value = map.get(key); break;
/** * Create a classifier from the provided map. The keys are patterns, using * '?' as a single character and '*' as multi-character wildcard. * * @param values the values to use in the {@link PatternMatcher} */ public PatternMatchingClassifier(Map<String, T> values) { super(); this.values = new PatternMatcher<T>(values); }
/** * Classify the input by matching it against the patterns provided in * {@link #setPatternMap(Map)}. The most specific pattern that matches will * be used to locate a value. * * @return the value matching the most specific pattern possible * * @throws IllegalStateException if no matching value is found. */ public T classify(String classifiable) { T value = values.match(classifiable); return value; }
/** * A map from pattern to value * @param values the pattern map to set */ public void setPatternMap(Map<String, T> values) { this.values = new PatternMatcher<T>(values); }
if (PatternMatcher.match(key, line)) { value = map.get(key); break;