
com.harium.suneidesis.linguistic.matcher.And Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Project to represent knowledge
The newest version!
package com.harium.suneidesis.linguistic.matcher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class And implements Matcher {
protected List matchers = new ArrayList<>();
public And(List matchers) {
this.matchers.addAll(matchers);
}
public And(Matcher... matchers) {
this.matchers.addAll(Arrays.asList(matchers));
}
@Override
public boolean matches(String[] tokens) {
if (matchers.isEmpty()) {
return true;
}
int matches = 0;
for (Matcher matcher : matchers) {
if (matcher.matches(tokens)) {
matches++;
}
}
return matches == matchers.size();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy