public ExpressionVariable( FactPattern fact ) { super( fact.getBoundName(), fact.getFactType(), fact.getFactType() ); if ( !fact.isBound() ) { throw new RuntimeException( "the fact is not bounded: " + fact ); } this.fact = fact; }
private boolean canConditionBeDeleted( BRLConditionColumn col ) { for ( IPattern p : col.getDefinition() ) { if ( p instanceof FactPattern ) { FactPattern fp = (FactPattern) p; if ( fp.isBound() ) { if ( isBindingUsed( fp.getBoundName() ) ) { return false; } } } } return true; }
private void generateFactPattern( final FactPattern pattern ) { if ( pattern.isNegated() ) { buf.append( "not " ); } else if ( pattern.isBound() ) { bindingsPatterns.put( pattern.getBoundName(), pattern ); buf.append( pattern.getBoundName() ); buf.append( " : " ); } if ( pattern.getFactType() != null ) { buf.append( pattern.getFactType() ); } buf.append( "( " ); // top level constraints if ( pattern.getConstraintList() != null ) { generateConstraints( pattern ); } buf.append( ")" ); //Add CEP window definition CEPWindow window = pattern.getWindow(); if ( window.isDefined() ) { buf.append( " " ); buf.append( window.getOperator() ); buf.append( buildOperatorParameterDRL( window.getParameters() ) ); } }
/** * Get the data-type associated with the binding * @param var * @return The data-type, or null if the binding could not be found */ public String getLHSBindingType( final String var ) { if ( this.lhs == null ) { return null; } for ( int i = 0; i < this.lhs.length; i++ ) { IPattern pat = this.lhs[ i ]; if ( pat instanceof FromCompositeFactPattern ) { pat = ( (FromCompositeFactPattern) pat ).getFactPattern(); } if ( pat instanceof FactPattern ) { final FactPattern p = (FactPattern) pat; if ( p.isBound() && var.equals( p.getBoundName() ) ) { return p.getFactType(); } for ( FieldConstraint fc : p.getFieldConstraints() ) { String type = getFieldBinding( fc, var ); if ( type != null ) { return type; } } } } return null; }
if ( fact.isBound() ) { result.add( fact.getBoundName() );
/** * This returns the pattern label. */ private Widget getPatternLabel( final FactPattern fp ) { ClickHandler click = new ClickHandler() { public void onClick( ClickEvent event ) { popupCreator.showPatternPopup( (Widget) event.getSource(), fp, null, false ); } }; String patternName = ( pattern.isBound() ) ? pattern.getFactType() + " <b>[" + pattern.getBoundName() + "]</b>" : pattern.getFactType(); String desc; if ( isAll0WithLabel ) { desc = Constants.INSTANCE.All0with( patternName ); } else { if ( pattern.getNumberOfConstraints() > 0 ) { desc = Constants.INSTANCE.ThereIsAAn0With( patternName ); } else { desc = Constants.INSTANCE.ThereIsAAn0( patternName ); } desc = anA( desc, patternName ); } return new ClickableLabel( desc, click, !this.readOnly ); }