private String getFactType( FactPattern fp, SingleFieldConstraint sfc ) { String factType; if ( sfc == null ) { factType = fp.getFactType(); } else { factType = sfc.getFieldType(); //If field name is "this" use parent FactPattern type otherwise we can use the Constraint's field type String fieldName = sfc.getFieldName(); if ( DataType.TYPE_THIS.equals( fieldName ) ) { factType = fp.getFactType(); } } return factType; }
private void visitSingleFieldConstraint( SingleFieldConstraint sfc ) { InterpolationVariable var = new InterpolationVariable( sfc.getValue(), sfc.getFieldType(), factPattern.getFactType(), sfc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == sfc.getConstraintValueType() && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } //Visit Connection constraints if ( sfc.getConnectives() != null ) { for ( int i = 0; i < sfc.getConnectives().length; i++ ) { final ConnectiveConstraint cc = sfc.getConnectives()[ i ]; InterpolationVariable ccVar = new InterpolationVariable( cc.getValue(), cc.getFieldType(), factPattern.getFactType(), cc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == cc.getConstraintValueType() && !vars.containsKey( ccVar ) ) { vars.put( ccVar, vars.size() ); } } } }
public void onClick( ClickEvent event ) { String[] fields = new String[ 0 ]; //If field name is "this" use parent FactPattern type otherwise we can use the Constraint's field type String fieldName = con.getFieldName(); if ( DataType.TYPE_THIS.equals( fieldName ) ) { fields = connectives.getCompletions().getFieldCompletions( pattern.getFactType() ); } else { fields = connectives.getCompletions().getFieldCompletions( con.getFieldType() ); } popupCreator.showBindFieldPopup( (Widget) event.getSource(), pattern, con, fields, popupCreator ); } };
protected String getFieldBinding( FieldConstraint fc, String var ) { String fieldType = null; if ( fc instanceof SingleFieldConstraint ) { SingleFieldConstraint s = (SingleFieldConstraint) fc; if ( s.isBound() && var.equals( s.getFieldBinding() ) ) { fieldType = s.getFieldType(); } } if ( fc instanceof SingleFieldConstraintEBLeftSide ) { SingleFieldConstraintEBLeftSide s = (SingleFieldConstraintEBLeftSide) fc; if ( s.isBound() && var.equals( s.getFieldBinding() ) ) { fieldType = s.getExpressionLeftSide().getGenericType(); } } if ( fc instanceof CompositeFieldConstraint ) { CompositeFieldConstraint s = (CompositeFieldConstraint) fc; if ( s.getConstraints() != null ) { for ( FieldConstraint ss : s.getConstraints() ) { fieldType = getFieldBinding( ss, var ); } } } return fieldType; }
addFieldRestriction( buf, constr.getConstraintValueType(), constr.getFieldType(), constr.getOperator(), parameters,
private SingleFieldConstraint visitSingleFieldConstraint( SingleFieldConstraint sfc ) { SingleFieldConstraint clone = new SingleFieldConstraint(); clone.setConstraintValueType( sfc.getConstraintValueType() ); clone.setExpressionValue( (ExpressionFormLine) visit( sfc.getExpressionValue() ) ); clone.setFieldBinding( sfc.getFieldBinding() ); clone.setFactType( sfc.getFactType() ); clone.setFieldName( sfc.getFieldName() ); clone.setFieldType( sfc.getFieldType() ); clone.setOperator( sfc.getOperator() ); for ( Map.Entry<String, String> entry : sfc.getParameters().entrySet() ) { clone.setParameter( entry.getKey(), entry.getValue() ); } clone.setValue( sfc.getValue() ); if ( sfc.getConnectives() != null ) { clone.setConnectives( new ConnectiveConstraint[ sfc.getConnectives().length ] ); for ( int i = 0; i < sfc.getConnectives().length; i++ ) { clone.getConnectives()[ i ] = (ConnectiveConstraint) visit( sfc.getConnectives()[ i ] ); } } return clone; }
fcr1sfc.getFieldName() ); assertEquals( DataType.TYPE_STRING, fcr1sfc.getFieldType() );
3 + col, connectives.connectives( constraint, constraint.getFieldType() ) );