org.daisy.pipeline.nlp.impl.FullMatchStringFinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nlp-common Show documentation
Show all versions of nlp-common Show documentation
Common API for NLP functionality and XProc steps
The newest version!
package org.daisy.pipeline.nlp.impl;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
* Try to match given fixed-length strings with a list of strings provided at
* initialization.
*/
public class FullMatchStringFinder implements IStringFinder {
private Set mSet = new HashSet();
@Override
public void compile(Collection matchable) {
mSet.addAll(matchable);
}
@Override
public String find(String input) {
if (mSet.contains(input))
return input;
return null;
}
@Override
public boolean threadsafe() {
return true;
}
}