private ActionRetractFact visitActionRetractFact(ActionRetractFact arf) { ActionRetractFact clone = new ActionRetractFact(); clone.variableName = arf.variableName; return clone; }
private ActionRetractFact visitActionRetractFact(ActionRetractFact arf) { ActionRetractFact clone = new ActionRetractFact(); clone.variableName = arf.variableName; return clone; }
private void doAction(List<LabelledAction> actions, ActionRetractFactCol52 rf, String cell) { LabelledAction a = new LabelledAction(); a.action = new ActionRetractFact( cell ); a.boundName = cell; actions.add( a ); }
private void doAction(List<LabelledAction> actions, ActionRetractFactCol52 rf, String cell) { LabelledAction a = new LabelledAction(); a.action = new ActionRetractFact( cell ); a.boundName = cell; actions.add( a ); }
@Test public void testRemoveItemRhs() { final RuleModel model = new RuleModel(); model.rhs = new IAction[3]; final ActionRetractFact r0 = new ActionRetractFact( "x" ); final ActionRetractFact r1 = new ActionRetractFact( "y" ); final ActionRetractFact r2 = new ActionRetractFact( "z" ); model.rhs[0] = r0; model.rhs[1] = r1; model.rhs[2] = r2; model.removeRhsItem( 1 ); assertEquals( 2, model.rhs.length ); assertEquals( r0, model.rhs[0] ); assertEquals( r2, model.rhs[1] ); }
@Test public void testActionRetractFact() { RuleModel model = new RuleModel(); model.rhs = new IAction[1]; ActionRetractFact arf = new ActionRetractFact(); arf.variableName = "$arf"; model.rhs[0] = arf; RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor(); RuleModel clone = cloneVisitor.visitRuleModel( model ); assertEquals( 1, clone.rhs.length ); assertNotSame( model.rhs[0], clone.rhs[0] ); assertNotNull( clone.rhs[0] ); assertTrue( clone.rhs[0] instanceof ActionRetractFact ); ActionRetractFact arfClone = (ActionRetractFact) clone.rhs[0]; assertEquals( "$arf", arfClone.variableName ); }
model.lhs.length ); final ActionRetractFact fact = new ActionRetractFact( "q" ); model.rhs[0] = fact; assertTrue( model.isBoundFactUsed( "q" ) );
private RuleModel getComplexModel() { final RuleModel m = new RuleModel(); m.addAttribute( new RuleAttribute( "no-loop", "true" ) ); final FactPattern pat = new FactPattern( "Person" ); pat.setBoundName( "p1" ); final SingleFieldConstraint con = new SingleFieldConstraint(); con.setFactType( "Person" ); con.setFieldBinding( "f1" ); con.setFieldName( "age" ); con.setOperator( "<" ); con.setValue( "42" ); pat.addConstraint( con ); m.addLhsItem( pat ); final CompositeFactPattern comp = new CompositeFactPattern( "not" ); comp.addFactPattern( new FactPattern( "Cancel" ) ); m.addLhsItem( comp ); final ActionUpdateField set = new ActionUpdateField(); set.variable = "p1"; set.addFieldValue( new ActionFieldValue( "status", "rejected", SuggestionCompletionEngine.TYPE_STRING ) ); m.addRhsItem( set ); final ActionRetractFact ret = new ActionRetractFact( "p1" ); m.addRhsItem( ret ); final DSLSentence sen = new DSLSentence(); sen.setDefinition( "Send an email to {administrator}" ); m.addRhsItem( sen ); return m; }
m.addRhsItem( set ); final ActionRetractFact ret = new ActionRetractFact( "p1" ); m.addRhsItem( ret );