private ActionInsertFactCol52ActionInsertFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
private ActionInsertFactCol52ActionInsertLogicalFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
private ActionInsertFactCol52ActionInsertFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
private ActionInsertFactCol52ActionInsertLogicalFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
@Test public void testFormula() { FieldNature val = new ActionFieldValue( "x", "y", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); assertFalse( val.isFormula() ); val = new ActionFieldValue( "x", "=y * 20", SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); assertTrue( val.isFormula() ); }
@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] ); }
@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] ); }
private ActionUpdateField visitActionFieldList(ActionUpdateField afl) { ActionUpdateField clone = new ActionUpdateField(); 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; }
private ActionUpdateField visitActionFieldList(ActionUpdateField afl) { ActionUpdateField clone = new ActionUpdateField(); 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; }
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; }
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; }
private ActionInsertFact visitActionFieldList(ActionInsertFact afl) { ActionInsertFact clone = new ActionInsertFact(); clone.factType = afl.factType; clone.setBoundName( afl.getBoundName() ); 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; }
private ActionInsertFact visitActionFieldList(ActionInsertFact afl) { ActionInsertFact clone = new ActionInsertFact(); clone.factType = afl.factType; clone.setBoundName( afl.getBoundName() ); 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 testAssertWithDSL() throws Exception { RuleModel m = new RuleModel(); DSLSentence sen = new DSLSentence(); sen.setDefinition( "I CAN HAS DSL" ); m.addRhsItem( sen ); ActionInsertFact ins = new ActionInsertFact( "Shizzle" ); ActionFieldValue val = new ActionFieldValue( "goo", "42", "Numeric" ); ins.fieldValues = new ActionFieldValue[ 1 ]; ins.fieldValues[ 0 ] = val; m.addRhsItem( ins ); ActionInsertLogicalFact insL = new ActionInsertLogicalFact( "Shizzle" ); ActionFieldValue valL = new ActionFieldValue( "goo", "42", "Numeric" ); insL.fieldValues = new ActionFieldValue[ 1 ]; insL.fieldValues[ 0 ] = valL; m.addRhsItem( insL ); String result = BRDRLPersistence.getInstance().marshal( m ); assertTrue( result.indexOf( ">insert" ) > -1 ); assertTrue( result.indexOf( ">insertLogical" ) > -1 ); }
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 ); }
private void doAction(List<LabelledAction> actions, ActionInsertFactCol52 ac, String cell) { LabelledAction a = findByLabelledAction( actions, ac.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = ac.getBoundName(); if ( !ac.isInsertLogical() ) { ActionInsertFact ins = new ActionInsertFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } else { ActionInsertLogicalFact ins = new ActionInsertLogicalFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } actions.add( a ); } ActionInsertFact ins = (ActionInsertFact) a.action; ActionFieldValue val = new ActionFieldValue( ac.getFactField(), cell, ac.getType() ); ins.addFieldValue( val ); }
private void doAction(List<LabelledAction> actions, ActionInsertFactCol52 ac, String cell) { LabelledAction a = findByLabelledAction( actions, ac.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = ac.getBoundName(); if ( !ac.isInsertLogical() ) { ActionInsertFact ins = new ActionInsertFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } else { ActionInsertLogicalFact ins = new ActionInsertLogicalFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } actions.add( a ); } ActionInsertFact ins = (ActionInsertFact) a.action; ActionFieldValue val = new ActionFieldValue( ac.getFactField(), cell, ac.getType() ); ins.addFieldValue( val ); }
ai.addFieldValue( new ActionFieldValue( "field1", "55", SuggestionCompletionEngine.TYPE_NUMERIC_BIGINTEGER ) );
ai.addFieldValue( new ActionFieldValue( "field1", "55", SuggestionCompletionEngine.TYPE_NUMERIC_BIGDECIMAL ) );