/** * @param idx Remove this index from the LHS. returns false if it was NOT * allowed to remove this item (ie it is used on the RHS). */ public boolean removeLhsItem( final int idx ) { final IPattern[] newList = new IPattern[ this.lhs.length - 1 ]; int newIdx = 0; for ( int i = 0; i < this.lhs.length; i++ ) { if ( i != idx ) { newList[ newIdx ] = this.lhs[ i ]; newIdx++; } else { IPattern pat = this.lhs[ i ]; if ( pat instanceof FromCompositeFactPattern ) { pat = ( (FromCompositeFactPattern) pat ).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.getBoundName() != null && isBoundFactUsed( p.getBoundName() ) ) { return false; } } } } this.lhs = newList; return true; }
model.rhs[0] = set; assertTrue( model.isBoundFactUsed( "x" ) ); assertFalse( model.isBoundFactUsed( "y" ) ); assertTrue( model.isBoundFactUsed( "q" ) ); assertFalse( model.isBoundFactUsed( "x" ) );
if ( bindable || !( modeller.getModel().isBoundFactUsed( pattern.getBoundName() ) ) ) { HorizontalPanel varName = new HorizontalPanel(); final TextBox varTxt = new BindingTextBox();
model.rhs[0] = set; assertTrue( model.isBoundFactUsed( "x" ) );