Search in sources :

Example 31 with InterpolationVariable

use of org.drools.workbench.models.datamodel.rule.InterpolationVariable in project drools-wb by kiegroup.

the class GuidedDecisionTablePopulater method createRHSChildColumns.

private void createRHSChildColumns(final RuleModel rm, final IAction action, final BRLActionColumn column, final List<BRLVariableColumn> variableColumns) {
    final Map<InterpolationVariable, Integer> templateKeys = new HashMap<>();
    final RuleModelVisitor rmv = new RuleModelVisitor(rm.lhs, templateKeys);
    rmv.visit(action);
    final List<InterpolationVariable> ivs = new ArrayList<>(templateKeys.keySet());
    for (BRLVariableColumn variableColumn : variableColumns) {
        final Iterator<InterpolationVariable> ivsIts = ivs.iterator();
        while (ivsIts.hasNext()) {
            final InterpolationVariable iv = ivsIts.next();
            if (iv.getVarName().equals(variableColumn.getVarName())) {
                final BRLActionVariableColumn source = (BRLActionVariableColumn) variableColumn;
                final BRLActionVariableColumn target = makeBRLActionVariableColumn(source, iv);
                column.getChildColumns().add(target);
                ivsIts.remove();
            }
        }
    }
}
Also used : RuleModelVisitor(org.drools.workbench.models.datamodel.rule.visitors.RuleModelVisitor) InterpolationVariable(org.drools.workbench.models.datamodel.rule.InterpolationVariable) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BRLVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLVariableColumn) BRLActionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)

Aggregations

InterpolationVariable (org.drools.workbench.models.datamodel.rule.InterpolationVariable)31 HashMap (java.util.HashMap)14 RuleModelVisitor (org.drools.workbench.models.datamodel.rule.visitors.RuleModelVisitor)10 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)8 FieldConstraint (org.drools.workbench.models.datamodel.rule.FieldConstraint)8 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)8 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)6 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)6 ConnectiveConstraint (org.drools.workbench.models.datamodel.rule.ConnectiveConstraint)6 Map (java.util.Map)4 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)4 IAction (org.drools.workbench.models.datamodel.rule.IAction)3 IPattern (org.drools.workbench.models.datamodel.rule.IPattern)3 BRLActionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)3 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)3 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)3 FreeFormLine (org.drools.workbench.models.datamodel.rule.FreeFormLine)2 BRLVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLVariableColumn)2 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)2