/** * This will return the ActionInsertFact that a variable is bound to. * * @param var * The bound fact variable (NOT bound field). * @return null or the ActionInsertFact found. */ public ActionInsertFact getRHSBoundFact(final String var) { if ( this.rhs == null ) { return null; } for ( int i = 0; i < this.rhs.length; i++ ) { if ( this.rhs[i] instanceof ActionInsertFact ) { final ActionInsertFact p = (ActionInsertFact) this.rhs[i]; if ( p.getBoundName() != null && var.equals( p.getBoundName() ) ) { return p; } } } return null; }
/** * This will return the ActionInsertFact that a variable is bound to. * * @param var * The bound fact variable (NOT bound field). * @return null or the ActionInsertFact found. */ public ActionInsertFact getRHSBoundFact(final String var) { if ( this.rhs == null ) { return null; } for ( int i = 0; i < this.rhs.length; i++ ) { if ( this.rhs[i] instanceof ActionInsertFact ) { final ActionInsertFact p = (ActionInsertFact) this.rhs[i]; if ( p.getBoundName() != null && var.equals( p.getBoundName() ) ) { return p; } } } return null; }
/** * This will return a List<String> of all ActionInsertFact bindings * * @return The bindings or an empty list if no bindings are found. */ public List<String> getRHSBoundFacts() { if ( this.rhs == null ) { return null; } final List<String> list = new ArrayList<String>(); for ( int i = 0; i < this.rhs.length; i++ ) { if ( this.rhs[i] instanceof ActionInsertFact ) { final ActionInsertFact p = (ActionInsertFact) this.rhs[i]; if ( p.getBoundName() != null ) { list.add( p.getBoundName() ); } } } return list; }
/** * This will return a List<String> of all ActionInsertFact bindings * * @return The bindings or an empty list if no bindings are found. */ public List<String> getRHSBoundFacts() { if ( this.rhs == null ) { return null; } final List<String> list = new ArrayList<String>(); for ( int i = 0; i < this.rhs.length; i++ ) { if ( this.rhs[i] instanceof ActionInsertFact ) { final ActionInsertFact p = (ActionInsertFact) this.rhs[i]; if ( p.getBoundName() != null ) { list.add( p.getBoundName() ); } } } return list; }
/** * This will get a list of all RHS bound variables. */ public List<String> getAllRHSVariables() { List<String> result = new ArrayList<String>(); for ( int i = 0; i < this.rhs.length; i++ ) { IAction pat = this.rhs[i]; if ( pat instanceof ActionInsertFact ) { ActionInsertFact fact = (ActionInsertFact) pat; if ( fact.isBound() ) { result.add( fact.getBoundName() ); } } } return result; }
/** * This will get a list of all RHS bound variables. */ public List<String> getAllRHSVariables() { List<String> result = new ArrayList<String>(); for ( int i = 0; i < this.rhs.length; i++ ) { IAction pat = this.rhs[i]; if ( pat instanceof ActionInsertFact ) { ActionInsertFact fact = (ActionInsertFact) pat; if ( fact.isBound() ) { result.add( fact.getBoundName() ); } } } return result; }
if ( action.fieldValues.length == 0 && action.getBoundName() == null ) { buf.append( ( isLogic ) ? "insertLogical( new " : "insert( new " ); } else { buf.append( action.factType ); if ( action.getBoundName() == null ) { buf.append( " fact" ); buf.append( idx ); } else { buf.append( " " + action.getBoundName() ); if ( action.getBoundName() == null ) { generateSetMethodCalls( "fact" + idx, action.fieldValues ); } else { generateSetMethodCalls( action.getBoundName(), action.fieldValues ); if ( action.getBoundName() == null ) { buf.append( "fact" ); buf.append( idx++ ); } else { buf.append( action.getBoundName() ); if ( action.getBoundName() == null ) { buf.append( "fact" ); buf.append( idx++ ); } else { buf.append( action.getBoundName() );
if ( action.fieldValues.length == 0 && action.getBoundName() == null ) { buf.append( ( isLogic ) ? "insertLogical( new " : "insert( new " ); } else { buf.append( action.factType ); if ( action.getBoundName() == null ) { buf.append( " fact" ); buf.append( idx ); } else { buf.append( " " + action.getBoundName() ); if ( action.getBoundName() == null ) { generateSetMethodCalls( "fact" + idx, action.fieldValues ); } else { generateSetMethodCalls( action.getBoundName(), action.fieldValues ); if ( action.getBoundName() == null ) { buf.append( "fact" ); buf.append( idx++ ); } else { buf.append( action.getBoundName() ); if ( action.getBoundName() == null ) { buf.append( "fact" ); buf.append( idx++ ); } else { buf.append( action.getBoundName() );
@Override public List<String> getRHSBoundFacts() { final Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getRHSBoundFacts() ); return new ArrayList<String>( variables ); }
@Override public List<String> getRHSBoundFacts() { final Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getRHSBoundFacts() ); return new ArrayList<String>( variables ); }
@Override public List<String> getAllRHSVariables() { Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getAllRHSVariables() ); return new ArrayList<String>( variables ); }
@Override public List<String> getAllRHSVariables() { Set<String> variables = new HashSet<String>(); for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; variables.add( action.getBoundName() ); } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { variables.add( action.getBoundName() ); } } } } } variables.addAll( super.getAllRHSVariables() ); return new ArrayList<String>( variables ); }
private void addAction(IAction action, List<LabelledAction> actions) { String binding = null; LabelledAction a = null; if ( action instanceof ActionInsertFact ) { final ActionInsertFact af = (ActionInsertFact) action; binding = af.getBoundName(); a = findByLabelledAction( actions, binding ); } else if ( action instanceof ActionSetField ) { final ActionSetField af = (ActionSetField) action; binding = af.variable; a = findByLabelledAction( actions, binding ); } //Binding is used to group related field setters together. It is essential for //ActionInsertFactCol and ActionSetFieldCol52 columns as these represent single //fields and need to be grouped together it is not essential for IAction's as //these contain their own list of fields. If a BRL fragment does not set //the binding use a unique identifier, in this case the Object itself. if ( binding == null ) { binding = action.toString(); } if ( a == null ) { a = new LabelledAction(); a.boundName = binding; a.action = action; actions.add( a ); } }
private void addAction(IAction action, List<LabelledAction> actions) { String binding = null; LabelledAction a = null; if ( action instanceof ActionInsertFact ) { final ActionInsertFact af = (ActionInsertFact) action; binding = af.getBoundName(); a = findByLabelledAction( actions, binding ); } else if ( action instanceof ActionSetField ) { final ActionSetField af = (ActionSetField) action; binding = af.variable; a = findByLabelledAction( actions, binding ); } //Binding is used to group related field setters together. It is essential for //ActionInsertFactCol and ActionSetFieldCol52 columns as these represent single //fields and need to be grouped together it is not essential for IAction's as //these contain their own list of fields. If a BRL fragment does not set //the binding use a unique identifier, in this case the Object itself. if ( binding == null ) { binding = action.toString(); } if ( a == null ) { a = new LabelledAction(); a.boundName = binding; a.action = action; actions.add( a ); } }
@Override public ActionInsertFact getRHSBoundFact(String var) { for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; if ( action.getBoundName().equals( var ) ) { if ( action.isInsertLogical() ) { return new ActionInsertFactCol52ActionInsertLogicalFactAdaptor( action ); } return new ActionInsertFactCol52ActionInsertFactAdaptor( action ); } } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { if ( action.getBoundName().equals( var ) ) { return action; } } } } } } return super.getRHSBoundFact( var ); }
@Override public ActionInsertFact getRHSBoundFact(String var) { for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; if ( action.getBoundName().equals( var ) ) { if ( action.isInsertLogical() ) { return new ActionInsertFactCol52ActionInsertLogicalFactAdaptor( action ); } return new ActionInsertFactCol52ActionInsertFactAdaptor( action ); } } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { if ( action.getBoundName().equals( var ) ) { return action; } } } } } } return super.getRHSBoundFact( var ); }
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; }
assertEquals( aif.getBoundName(), "$r" ); assertEquals( 1,
aif0Clone.factType ); assertEquals( "$t0", aif0Clone.getBoundName() ); assertEquals( 2, aif0Clone.fieldValues.length ); aif1Clone.factType ); assertEquals( "$t1", aif1Clone.getBoundName() ); assertEquals( 2, aif1Clone.fieldValues.length );