private boolean isParentFactPattern(final FactPattern fp) { for ( FieldConstraint fc : fp.getFieldConstraints() ) { if ( isParentFactPattern( fc ) ) { return true; } } return false; }
private void visitFactPattern(FactPattern pattern) { this.factPattern = pattern; for ( FieldConstraint fc : pattern.getFieldConstraints() ) { visit( fc ); } }
private void fixConnectiveConstraints(FactPattern p) { for ( FieldConstraint fc : p.getFieldConstraints() ) { fixConnectiveConstraints( fc ); } }
private void fixConstraints(FactPattern p) { for ( FieldConstraint fc : p.getFieldConstraints() ) { fixConstraints( p, fc ); } }
private void visitFactPattern(FactPattern pattern) { this.factPattern = pattern; for ( FieldConstraint fc : pattern.getFieldConstraints() ) { visit( fc ); } }
private void fixConnectiveConstraints(FactPattern p) { for ( FieldConstraint fc : p.getFieldConstraints() ) { fixConnectiveConstraints( fc ); } }
private void fixConstraints(FactPattern p) { for ( FieldConstraint fc : p.getFieldConstraints() ) { fixConstraints( p, fc ); } }
private boolean isParentFactPattern(final FactPattern fp) { for ( FieldConstraint fc : fp.getFieldConstraints() ) { if ( isParentFactPattern( fc ) ) { return true; } } return false; }
private void generateConstraints( FactPattern pattern ) { int printedCount = 0; for ( int i = 0; i < pattern.getFieldConstraints().length; i++ ) { StringBuilder buffer = new StringBuilder(); generateConstraint( pattern.constraintList.constraints[ i ], false, buffer ); if ( buffer.length() > 0 ) { if ( printedCount > 0 ) { buf.append( ", " ); } buf.append( buffer ); printedCount++; } } }
private void generateConstraints( FactPattern pattern ) { int printedCount = 0; for ( int i = 0; i < pattern.getFieldConstraints().length; i++ ) { StringBuilder buffer = new StringBuilder(); generateConstraint( pattern.constraintList.constraints[ i ], false, buffer ); if ( buffer.length() > 0 ) { if ( printedCount > 0 ) { buf.append( ", " ); } buf.append( buffer ); printedCount++; } } }
/** * 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 visitFactPattern(final FactPattern fp) { if ( isParentFactPattern( fp ) ) { for ( FieldConstraint fc : fp.getFieldConstraints() ) { visit( fc ); } } }
private void visitFactPattern(final FactPattern fp) { if ( isParentFactPattern( fp ) ) { for ( FieldConstraint fc : fp.getFieldConstraints() ) { visit( fc ); } } }
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 ) ) {
return p.getFactType(); for ( FieldConstraint fc : p.getFieldConstraints() ) { String type = getFieldBinding( fc, var );
for ( int j = 0; j < fact.getFieldConstraints().length; j++ ) { FieldConstraint fc = fact.getFieldConstraints()[j]; if ( fc instanceof SingleFieldConstraintEBLeftSide ) { SingleFieldConstraintEBLeftSide exp = (SingleFieldConstraintEBLeftSide) fc;
@Override public FieldConstraint getLHSBoundField(String var) { for ( CompositeColumn< ? extends BaseColumn> col : dtable.getConditions() ) { if ( col instanceof Pattern52 ) { Pattern52 p = (Pattern52) col; for ( ConditionCol52 cc : p.getChildColumns() ) { if ( cc.isBound() && cc.getBinding().equals( var ) ) { return new ConditionCol52FieldConstraintAdaptor( cc ); } } } else if ( col instanceof BRLConditionColumn ) { BRLConditionColumn brl = (BRLConditionColumn) col; for ( IPattern p : brl.getDefinition() ) { if ( p instanceof FactPattern ) { final FactPattern fp = (FactPattern) p; for ( FieldConstraint fc : fp.getFieldConstraints() ) { List<String> fieldBindings = getFieldBinding( fc ); if ( fieldBindings.contains( var ) ) { return fc; } } } } } } return super.getLHSBoundField( var ); }
@Test public void testGetFieldConstraints() { FactPattern pat = new FactPattern(); assertEquals(0, pat.getFieldConstraints().length); assertNull(pat.constraintList); pat.addConstraint( new SingleFieldConstraint() ); assertNotNull(pat.constraintList); assertEquals(1, pat.getFieldConstraints().length); }
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; }
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; }