/** * 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 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.getFieldValues().length == 0 && action.getBoundName() == null ) { buf.append( ( isLogic ) ? "insertLogical( new " : "insert( new " ); } else { buf.append( action.getFactType() ); if ( action.getBoundName() == null ) { buf.append( " fact" ); buf.append( idx ); } else { buf.append( " " + action.getBoundName() ); if ( action.getBoundName() == null ) { generateSetMethodCalls( "fact" + idx, action.getFieldValues() ); } else { generateSetMethodCalls( action.getBoundName(), action.getFieldValues() ); 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() );
public void onClick( ClickEvent event ) { String var = varName.getText(); if ( getModeller().isVariableNameUsed( var ) && ( ( model.getBoundName() != null && model.getBoundName().equals( var ) == false ) || model.getBoundName() == null ) ) { Window.alert( Constants.INSTANCE.TheVariableName0IsAlreadyTaken( var ) ); return; } model.setBoundName( var ); setModified( true ); getModeller().refreshWidget(); popup.hide(); } } );
private Widget getAssertLabel() { ClickHandler cl = new ClickHandler() { public void onClick( ClickEvent event ) { Widget w = (Widget) event.getSource(); showAddFieldPopup( w ); } }; String assertType = "assert"; //NON-NLS if ( this.model instanceof ActionInsertLogicalFact) { assertType = "assertLogical"; //NON-NLS } String lbl = ( model.isBound() == false ) ? HumanReadable.getActionDisplayName(assertType) + " <b>" + this.model.getFactType() + "</b>" : HumanReadable.getActionDisplayName( assertType ) + " <b>" + this.model.getFactType() + "</b>" + " <b>[" + model.getBoundName() + "]</b>"; if ( this.model.getFieldValues() != null && model.getFieldValues().length > 0 ) { lbl = lbl + ":"; } return new ClickableLabel( lbl, cl, !this.readOnly ); }
private ActionInsertFact visitActionFieldList( ActionInsertFact afl ) { ActionInsertFact clone = new ActionInsertFact(); clone.setFactType( afl.getFactType() ); clone.setBoundName( afl.getBoundName() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { 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; }
if ( this.model.getBoundName() != null ) { varName.setText( this.model.getBoundName() );
assertEquals( aif.getBoundName(), "$r" ); assertEquals( 1,
assertEquals( aif.getBoundName(), "$r" ); assertEquals( 4,