use of org.drools.model.Pattern in project drools by kiegroup.
the class AccumulatePatternImpl method findPatternImplSource.
private Pattern findPatternImplSource() {
if (condition instanceof Pattern) {
return (Pattern) condition;
}
final Variable source = getAccumulateFunctions()[0].getSource();
for (Condition subCondition : condition.getSubConditions()) {
if (subCondition instanceof PatternImpl) {
PatternImpl patternImpl = (PatternImpl) subCondition;
boolean isSource = patternImpl.getBindings().stream().anyMatch(b -> (b instanceof Binding) && ((Binding) b).getBoundVariable().equals(source));
if (isSource) {
return patternImpl;
}
}
}
return null;
}
Aggregations