private void visitFactPattern( FactPattern pattern ) { this.factPattern = pattern; for ( FieldConstraint fc : pattern.getFieldConstraints() ) { visit( fc ); } }
/** * This will return the FieldConstraint that a variable is bound to. * @param var The bound field variable (NOT bound fact). * @return null or the FieldConstraint found. */ public FieldConstraint getLHSBoundField( 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; for ( int j = 0; j < p.getFieldConstraints().length; j++ ) { FieldConstraint fc = p.getFieldConstraints()[ j ]; List<String> fieldBindings = getFieldBinding( fc ); if ( fieldBindings.contains( var ) ) { return fc; } } } } return null; }
private void generateConstraints( final FactPattern pattern ) { int printedCount = 0; for ( int i = 0; i < pattern.getFieldConstraints().length; i++ ) { StringBuilder buffer = new StringBuilder(); generateConstraint( pattern.getConstraintList().getConstraints()[ i ], false, buffer ); if ( buffer.length() > 0 ) { if ( printedCount > 0 ) { buf.append( ", " ); } buf.append( buffer ); printedCount++; } } }
return p; for ( int j = 0; j < p.getFieldConstraints().length; j++ ) { FieldConstraint fc = p.getFieldConstraints()[ j ]; List<String> fieldBindings = getFieldBinding( fc ); if ( fieldBindings.contains( var ) ) {
/** * 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; }
for ( int j = 0; j < fact.getFieldConstraints().length; j++ ) { FieldConstraint fc = fact.getFieldConstraints()[ j ]; if ( fc instanceof SingleFieldConstraintEBLeftSide ) { SingleFieldConstraintEBLeftSide exp = (SingleFieldConstraintEBLeftSide) fc;
private FactPattern visitFactPattern( FactPattern pattern ) { FactPattern clone = new FactPattern(); clone.setBoundName( pattern.getBoundName() ); clone.setFactType( pattern.getFactType() ); clone.setNegated( pattern.isNegated() ); CEPWindow cloneCEPWindow = new CEPWindow(); cloneCEPWindow.setOperator( pattern.getWindow().getOperator() ); cloneCEPWindow.setParameters( cloneCEPWindowParameters( pattern.getWindow() ) ); clone.setWindow( cloneCEPWindow ); for ( FieldConstraint fc : pattern.getFieldConstraints() ) { clone.addConstraint( (FieldConstraint) visit( fc ) ); } return clone; }
"modeller-fact-TypeHeader" ); List<FieldConstraint> sortedConst = sortConstraints( pattern.getFieldConstraints() ); pattern.setFieldConstraints( sortedConst ); drawConstraints( sortedConst,