All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.daisy.pipeline.nlp.impl.FullMatchStringFinder Maven / Gradle / Ivy

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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy