1   package org.daisy.pipeline.nlp.impl;
2   
3   import java.util.Collection;
4   import java.util.HashSet;
5   import java.util.Set;
6   
7   /**
8    * Try to match given fixed-length strings with a list of strings provided at
9    * initialization.
10   */
11  public class FullMatchStringFinder implements IStringFinder {
12  
13  	private Set<String> mSet = new HashSet<String>();
14  
15  	@Override
16  	public void compile(Collection<String> matchable) {
17  		mSet.addAll(matchable);
18  	}
19  
20  	@Override
21  	public String find(String input) {
22  		if (mSet.contains(input))
23  			return input;
24  		return null;
25  	}
26  
27  	@Override
28  	public boolean threadsafe() {
29  		return true;
30  	}
31  
32  }