import java.util.Set;
public class EligibilityUtil {
public static EligibilityDesc verifyInputStream(ExprNode expression, int indexedStream) {
ExprNodeIdentifierCollectVisitor visitor = new ExprNodeIdentifierCollectVisitor();
expression.accept(visitor);
Set<Integer> inputStreamsRequired = visitor.getStreamsRequired();
if (inputStreamsRequired.size() > 1) { // multi-stream dependency no optimization (i.e. a+b=c)
return new EligibilityDesc(Eligibility.INELIGIBLE, null);
}
if (inputStreamsRequired.size() == 1 && inputStreamsRequired.iterator().next() == indexedStream) { // self-compared no optimization
return new EligibilityDesc(Eligibility.INELIGIBLE, null);