public Map<String, List<String>> extract(final GuidedDecisionTable52 dtable, final List<IAction> fragment) { final BRLRuleModel rm = new BRLRuleModel(dtable); fragment.stream() .filter(iAction -> iAction instanceof ActionFieldList) .map(iAction -> (ActionFieldList) iAction) .forEach(iAction -> extract(rm, iAction)); return typeFields; }
public Map<String, List<String>> extract(final GuidedDecisionTable52 dtable, final List<IAction> fragment) { final BRLRuleModel rm = new BRLRuleModel(dtable); fragment.stream() .filter(iAction -> iAction instanceof ActionFieldList) .map(iAction -> (ActionFieldList) iAction) .forEach(iAction -> extract(rm, iAction)); return typeFields; }
private RuleModel newRuleModel() { final BRLRuleModel ruleModel = new BRLRuleModel(getModel()); final List<IPattern> definition = editingCol.getDefinition(); ruleModel.lhs = definition.toArray(new IPattern[definition.size()]); return ruleModel; }
private RuleModel newRuleModel() { final BRLRuleModel ruleModel = new BRLRuleModel(getModel()); final List<IPattern> definition = editingCol.getDefinition(); ruleModel.lhs = definition.toArray(new IPattern[definition.size()]); return ruleModel; }
private RuleModel newRuleModel() { final BRLRuleModel ruleModel = new BRLRuleModel(presenter.getModel()); final List<IAction> definition = editingCol.getDefinition(); ruleModel.rhs = definition.toArray(new IAction[definition.size()]); return ruleModel; }
private RuleModel newRuleModel() { final BRLRuleModel ruleModel = new BRLRuleModel(presenter.getModel()); final List<IAction> definition = editingCol.getDefinition(); ruleModel.rhs = definition.toArray(new IAction[definition.size()]); return ruleModel; }
boolean isBindingUnique(String binding) { final BRLRuleModel brlRuleModel = new BRLRuleModel(model()); return !brlRuleModel.isVariableNameUsed(binding); }
boolean isNewFactPattern() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); return !variables .stream() .anyMatch(b -> b.equals(patternWrapper().getBoundName())); }
List<String> getLHSBoundFacts() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); return brlRuleModel.getLHSBoundFacts(); }
boolean isBindingUnique(String binding) { final BRLRuleModel brlRuleModel = new BRLRuleModel(model()); return !brlRuleModel.isVariableNameUsed(binding); }
boolean isNewFactPattern() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); return !variables .stream() .anyMatch(b -> b.equals(patternWrapper().getBoundName())); }
List<String> getLHSBoundFacts() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); return brlRuleModel.getLHSBoundFacts(); }
boolean isNewFactPattern() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); return !variables .stream() .anyMatch(b -> b.equals(patternWrapper().getBoundName())); }
boolean isNewFactPattern() { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); return !variables .stream() .anyMatch(b -> b.equals(patternWrapper().getBoundName())); }
@Before public void setup() { super.setup(); this.rm = new BRLRuleModel(dtable); }
BRLRuleModel makeBRLRuleModel() { final GuidedDecisionTable52 model = getPresenter().getModel(); final BRLRuleModel brlRuleModel = new BRLRuleModel(model); final FactPattern pat = patternWrapper().makeFactPattern(); brlRuleModel.addLhsItem(pat); return brlRuleModel; }
BRLRuleModel makeBRLRuleModel() { final GuidedDecisionTable52 model = getPresenter().getModel(); final BRLRuleModel brlRuleModel = new BRLRuleModel(model); final FactPattern pat = patternWrapper().makeFactPattern(); brlRuleModel.addLhsItem(pat); return brlRuleModel; }
@Test public void testRuleModelWithRHSBoundFactsUsageWithBRLActionColumn() { final GuidedDecisionTable52 dt = new GuidedDecisionTable52(); //Setup Decision Table columns final Pattern52 p1 = new Pattern52(); p1.setFactType("Driver"); p1.setBoundName("$d"); dt.getConditions().add(p1); final BRLActionColumn brl = new BRLActionColumn(); brl.setDefinition(Collections.singletonList(new ActionSetField() {{ setVariable("$d"); }})); dt.getActionCols().add(brl); final BRLRuleModel model = new BRLRuleModel(dt); //Checks assertTrue(model.isBoundFactUsed("$d")); assertFalse(model.isBoundFactUsed("$cheese")); }
@Test public void testRuleModelWithRHSBoundFactsUsageWithLimitedEntryActionRetractFact() { final GuidedDecisionTable52 dt = new GuidedDecisionTable52(); //Setup Decision Table columns final Pattern52 p1 = new Pattern52(); p1.setFactType("Driver"); p1.setBoundName("$d"); dt.getConditions().add(p1); final LimitedEntryActionRetractFactCol52 del = new LimitedEntryActionRetractFactCol52(); del.setValue(new DTCellValue52("$d")); dt.getActionCols().add(del); final BRLRuleModel model = new BRLRuleModel(dt); //Checks assertTrue(model.isBoundFactUsed("$d")); assertFalse(model.isBoundFactUsed("$cheese")); }
@Test public void testRuleModelWithRHSBoundFactsUsageWithActionSetField() { final GuidedDecisionTable52 dt = new GuidedDecisionTable52(); //Setup Decision Table columns final Pattern52 p1 = new Pattern52(); p1.setFactType("Driver"); p1.setBoundName("$d"); dt.getConditions().add(p1); final ActionSetFieldCol52 set = new ActionSetFieldCol52(); set.setBoundName("$d"); set.setFactField("rating"); dt.getActionCols().add(set); final BRLRuleModel model = new BRLRuleModel(dt); //Checks assertTrue(model.isBoundFactUsed("$d")); assertFalse(model.isBoundFactUsed("$cheese")); }