private void visitSingleFieldConstraint(final SingleFieldConstraint sfc) { if ( sfc.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_TEMPLATE ) { this.peerVariables.add( new ValueHolder( sfc.getFieldName(), sfc.getValue(), ValueHolder.Type.TEMPLATE_KEY ) ); } else { this.peerVariables.add( new ValueHolder( sfc.getFieldName(), sfc.getValue(), ValueHolder.Type.VALUE ) ); } }
private void visitSingleFieldConstraint(final SingleFieldConstraint sfc) { if ( sfc.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_TEMPLATE ) { this.peerVariables.add( new ValueHolder( sfc.getFieldName(), sfc.getValue(), ValueHolder.Type.TEMPLATE_KEY ) ); } else { this.peerVariables.add( new ValueHolder( sfc.getFieldName(), sfc.getValue(), ValueHolder.Type.VALUE ) ); } }
/** * This returns a list of enums options (values) that can be used for the * given field of the given FactPattern. This also takes into account enums * that depend on other fields. */ public DropDownData getEnums(String factType, CompositeFieldConstraint constraintList, String field) { if ( field == null ) { return null; } Map<String, String> currentValueMap = new HashMap<String, String>(); if ( constraintList != null && constraintList.constraints != null ) { for ( FieldConstraint con : constraintList.constraints ) { if ( con instanceof SingleFieldConstraint ) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put( fieldName, sfc.getValue() ); } } } return getEnums( factType, field, currentValueMap ); }
/** * This returns a list of enums options (values) that can be used for the * given field of the given FactPattern. This also takes into account enums * that depend on other fields. */ public DropDownData getEnums(String factType, CompositeFieldConstraint constraintList, String field) { if ( field == null ) { return null; } Map<String, String> currentValueMap = new HashMap<String, String>(); if ( constraintList != null && constraintList.constraints != null ) { for ( FieldConstraint con : constraintList.constraints ) { if ( con instanceof SingleFieldConstraint ) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put( fieldName, sfc.getValue() ); } } } return getEnums( factType, field, currentValueMap ); }
private void fixConnectiveConstraints(SingleFieldConstraint sfc) { if ( sfc.connectives == null ) { return; } for ( ConnectiveConstraint cc : sfc.connectives ) { if ( cc.getFieldName() == null ) { cc.setFieldName( sfc.getFieldName() ); cc.setFieldType( sfc.getFieldType() ); } } }
private void fixConnectiveConstraints(SingleFieldConstraint sfc) { if ( sfc.connectives == null ) { return; } for ( ConnectiveConstraint cc : sfc.connectives ) { if ( cc.getFieldName() == null ) { cc.setFieldName( sfc.getFieldName() ); cc.setFieldType( sfc.getFieldType() ); } } }
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.connectives != null ) { for ( int i = 0; i < sfc.connectives.length; i++ ) { final ConnectiveConstraint cc = sfc.connectives[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() ); } } } }
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.connectives != null ) { for ( int i = 0; i < sfc.connectives.length; i++ ) { final ConnectiveConstraint cc = sfc.connectives[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() ); } } } }
private void fixConstraints(FactPattern fp, SingleFieldConstraint sfc) { sfc.setFactType( fp.getFactType() ); sfc.setFieldName( fixFieldName( sfc.getFieldName() ) ); if ( sfc.connectives == null ) { return; } for ( ConnectiveConstraint cc : sfc.connectives ) { cc.setFactType( fp.getFactType() ); cc.setFieldName( fixFieldName( cc.getFieldName() ) ); } }
private void fixConstraints(FactPattern fp, SingleFieldConstraint sfc) { sfc.setFactType( fp.getFactType() ); sfc.setFieldName( fixFieldName( sfc.getFieldName() ) ); if ( sfc.connectives == null ) { return; } for ( ConnectiveConstraint cc : sfc.connectives ) { cc.setFactType( fp.getFactType() ); cc.setFieldName( fixFieldName( cc.getFieldName() ) ); } }
StringBuilder parentBuf = new StringBuilder(); while ( parent != null ) { String fieldName = parent.getFieldName(); parentBuf.insert( 0, fieldName + "." ); buf.append( ( (SingleFieldConstraintEBLeftSide) constr ).getExpressionLeftSide().getText() ); } else { String fieldName = constr.getFieldName(); buf.append( fieldName );
StringBuilder parentBuf = new StringBuilder(); while ( parent != null ) { String fieldName = parent.getFieldName(); parentBuf.insert( 0, fieldName + "." ); buf.append( ( (SingleFieldConstraintEBLeftSide) constr ).getExpressionLeftSide().getText() ); } else { String fieldName = constr.getFieldName(); buf.append( fieldName );
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.connectives != null ) { clone.connectives = new ConnectiveConstraint[sfc.connectives.length]; for ( int i = 0; i < sfc.connectives.length; i++ ) { clone.connectives[i] = (ConnectiveConstraint) visit( sfc.connectives[i] ); } } return clone; }
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.connectives != null ) { clone.connectives = new ConnectiveConstraint[sfc.connectives.length]; for ( int i = 0; i < sfc.connectives.length; i++ ) { clone.connectives[i] = (ConnectiveConstraint) visit( sfc.connectives[i] ); } } return clone; }
cons.getConstraintValueType() ); assertEquals( "name", cons.getFieldName() ); assertEquals( "==", cons.getOperator() ); cons.getConstraintValueType() ); assertEquals( "age", cons.getFieldName() ); assertEquals( "<", cons.getOperator() ); cons = (SingleFieldConstraint) cheese.constraintList.constraints[0]; assertEquals( "type", cons.getFieldName() ); assertEquals( "==", cons.getOperator() );
cons.getConstraintValueType() ); assertEquals( "name", cons.getFieldName() ); assertEquals( "==", cons.getOperator() ); cons.getConstraintValueType() ); assertEquals( "age", cons.getFieldName() ); assertEquals( "<", cons.getOperator() );
SingleFieldConstraint fcr1sfc = (SingleFieldConstraint) fcr1; assertEquals( "name", fcr1sfc.getFieldName() ); assertEquals( SuggestionCompletionEngine.TYPE_STRING, fcr1sfc.getFieldType() );
assertEquals( sfc0.getFactType(), sfc0Clone.getFactType() ); assertEquals( sfc0.getFieldName(), sfc0Clone.getFieldName() ); assertEquals( sfc0.getFieldType(), sfc0Clone.getFieldType() ); assertEquals( sfc1.getFactType(), sfc1Clone.getFactType() ); assertEquals( sfc1.getFieldName(), sfc1Clone.getFieldName() ); assertEquals( sfc1.getFieldType(), sfc1Clone.getFieldType() );
assertEquals( sfc0.getFactType(), sfc0Clone.getFactType() ); assertEquals( sfc0.getFieldName(), sfc0Clone.getFieldName() ); assertEquals( sfc0.getFieldType(), sfc0Clone.getFieldType() ); assertEquals( sfc1.getFactType(), sfc1Clone.getFactType() ); assertEquals( sfc1.getFieldName(), sfc1Clone.getFieldName() ); assertEquals( sfc1.getFieldType(), sfc1Clone.getFieldType() );
assertEquals( sfc0.getFactType(), sfc0Clone.getFactType() ); assertEquals( sfc0.getFieldName(), sfc0Clone.getFieldName() ); assertEquals( sfc0.getFieldType(), sfc0Clone.getFieldType() );