private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.variable = afl.variable; for ( ActionFieldValue afv : afl.fieldValues ) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField( afv.getField() ); afvClone.setNature( afv.getNature() ); afvClone.setType( afv.getType() ); afvClone.setValue( afv.getValue() ); clone.addFieldValue( afvClone ); } return clone; }
@Test public void testAddItemRhs() { final RuleModel model = new RuleModel(); final IAction a0 = new ActionSetField(); final IAction a1 = new ActionSetField(); model.addRhsItem( a0 ); assertEquals( 1, model.rhs.length ); model.addRhsItem( a1 ); assertEquals( 2, model.rhs.length ); assertEquals( a0, model.rhs[0] ); assertEquals( a1, model.rhs[1] ); }
private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.variable = afl.variable; for ( ActionFieldValue afv : afl.fieldValues ) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField( afv.getField() ); afvClone.setNature( afv.getNature() ); afvClone.setType( afv.getType() ); afvClone.setValue( afv.getValue() ); clone.addFieldValue( afvClone ); } return clone; }
a.boundName = sf.getBoundName(); if ( !sf.isUpdate() ) { a.action = new ActionSetField( sf.getBoundName() ); } else { a.action = new ActionUpdateField( sf.getBoundName() );
a.boundName = sf.getBoundName(); if ( !sf.isUpdate() ) { a.action = new ActionSetField( sf.getBoundName() ); } else { a.action = new ActionUpdateField( sf.getBoundName() );
private void doAction(List<LabelledAction> actions, ActionSetFieldCol52 sf, String cell) { LabelledAction a = findByLabelledAction( actions, sf.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = sf.getBoundName(); if ( !sf.isUpdate() ) { a.action = new ActionSetField( sf.getBoundName() ); } else { a.action = new ActionUpdateField( sf.getBoundName() ); } actions.add( a ); } else if ( sf.isUpdate() && !(a.action instanceof ActionUpdateField) ) { // lets swap it out for an update as the user has asked for it. ActionSetField old = (ActionSetField) a.action; ActionUpdateField update = new ActionUpdateField( sf.getBoundName() ); update.fieldValues = old.fieldValues; a.action = update; } ActionSetField asf = (ActionSetField) a.action; ActionFieldValue val = new ActionFieldValue( sf.getFactField(), cell, sf.getType() ); asf.addFieldValue( val ); }
private void doAction(List<LabelledAction> actions, ActionSetFieldCol52 sf, String cell) { LabelledAction a = findByLabelledAction( actions, sf.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = sf.getBoundName(); if ( !sf.isUpdate() ) { a.action = new ActionSetField( sf.getBoundName() ); } else { a.action = new ActionUpdateField( sf.getBoundName() ); } actions.add( a ); } else if ( sf.isUpdate() && !(a.action instanceof ActionUpdateField) ) { // lets swap it out for an update as the user has asked for it. ActionSetField old = (ActionSetField) a.action; ActionUpdateField update = new ActionUpdateField( sf.getBoundName() ); update.fieldValues = old.fieldValues; a.action = update; } ActionSetField asf = (ActionSetField) a.action; ActionFieldValue val = new ActionFieldValue( sf.getFactField(), cell, sf.getType() ); asf.addFieldValue( val ); }
@Test public void testRemove() { final ActionSetField set = new ActionSetField(); set.fieldValues = new ActionFieldValue[2]; final ActionFieldValue v0 = new ActionFieldValue( "x", "42", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); final ActionFieldValue v1 = new ActionFieldValue( "y", "43", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); set.fieldValues[0] = v0; set.fieldValues[1] = v1; set.removeField( 1 ); assertEquals( 1, set.fieldValues.length ); assertEquals( v0, set.fieldValues[0] ); }
ActionSetField au = new ActionSetField( "$p" ); au.addFieldValue( new ActionFieldValue( "dob", "31-Jan-2000",
@Test public void testAdd() { final ActionSetField set = new ActionSetField(); set.fieldValues = new ActionFieldValue[2]; final ActionFieldValue v0 = new ActionFieldValue( "x", "42", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); final ActionFieldValue v1 = new ActionFieldValue( "y", "43", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); set.fieldValues[0] = v0; set.fieldValues[1] = v1; final ActionFieldValue q = new ActionFieldValue( "q", "q", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); set.addFieldValue( q ); assertEquals( 3, set.fieldValues.length ); assertEquals( q, set.fieldValues[2] ); assertEquals( v0, set.fieldValues[0] ); }
ActionSetField asf = new ActionSetField(); asf.variable = "$r"; ActionWorkItemFieldValue fv1 = new ActionWorkItemFieldValue( "ResultsBooleanResult",
final ActionSetField set = new ActionSetField(); set.variable = "x"; model.rhs[0] = set;
final RuleModel model = new RuleModel(); final ActionSetField a = new ActionSetField(); model.addRhsItem( a ); model.rhs.length ); final ActionSetField b = new ActionSetField(); model.addRhsItem( b ); model.rhs.length ); final ActionSetField c = new ActionSetField(); model.addRhsItem( c, true ); final ActionSetField d = new ActionSetField(); model.addRhsItem( d, false ); final ActionSetField e = new ActionSetField(); model.addRhsItem( e, 2 ); final ActionSetField f = new ActionSetField(); final ActionSetField g = new ActionSetField(); model.addRhsItem( f, -1 );
final ActionSetField set = new ActionSetField(); set.variable = "x"; model.rhs[0] = set;
ActionSetField asf0 = new ActionSetField( "ASF0" ); ActionFieldValue asf0f0 = new ActionFieldValue( "ASF0F0", "ASF0F0Value", ActionSetField asf1 = new ActionSetField( "ASF1" ); ActionFieldValue asf1f0 = new ActionFieldValue( "ASF1F0", "ASF1F0Value",
@Test public void testIsDSLEnhanced() throws Exception { RuleModel m = new RuleModel(); assertFalse( m.hasDSLSentences() ); m.addLhsItem( new FactPattern() ); assertFalse( m.hasDSLSentences() ); m.addRhsItem( new ActionSetField( "q" ) ); assertFalse( m.hasDSLSentences() ); m.addLhsItem( new DSLSentence() ); assertTrue( m.hasDSLSentences() ); m.addRhsItem( new DSLSentence() ); assertTrue( m.hasDSLSentences() ); m = new RuleModel(); m.addLhsItem( new DSLSentence() ); assertTrue( m.hasDSLSentences() ); m = new RuleModel(); m.addRhsItem( new DSLSentence() ); assertTrue( m.hasDSLSentences() ); }
ActionSetField asf0 = new ActionSetField( "ASF0" ); asf0.variable = "$t0"; ActionFieldValue asf0f0 = new ActionFieldValue( "ASF0F0", model.rhs[0] = asf0; ActionSetField asf1 = new ActionSetField( "ASF1" ); asf1.variable = "$t1"; ActionFieldValue asf1f0 = new ActionFieldValue( "ASF1F0",