use of org.drools.model.view.SelfPatternBiding in project drools by kiegroup.
the class KiePackagesBuilder method addInnerBindings.
private void addInnerBindings(Collection<Binding> bindings, AccumulateFunction[] accumulateFunctions, Condition condition) {
List<org.drools.model.Declaration> functionArgList = Arrays.stream(accumulateFunctions).map(function -> function.getSource()).filter(org.drools.model.Declaration.class::isInstance).map(org.drools.model.Declaration.class::cast).collect(Collectors.toList());
if (condition instanceof CompositePatterns) {
CompositePatterns compositePatterns = (CompositePatterns) condition;
for (Condition c : compositePatterns.getSubConditions()) {
Variable<?>[] boundVariables = c.getBoundVariables();
Arrays.stream(boundVariables).filter(org.drools.model.Declaration.class::isInstance).map(org.drools.model.Declaration.class::cast).filter(decl -> functionArgList.contains(decl)).forEach(decl -> bindings.add(new SelfPatternBiding<>((org.drools.model.Declaration) decl)));
}
}
}
Aggregations