Examples of ConnectiveConstraint


Examples of org.drools.brms.client.modeldriven.brl.ConnectiveConstraint

                                     constr.value );

                //and now do the connectives.
                if ( constr.connectives != null ) {
                    for ( int j = 0; j < constr.connectives.length; j++ ) {
                        final ConnectiveConstraint conn = constr.connectives[j];
                        addFieldRestriction( buf,
                                             conn.constraintValueType,
                                             conn.operator,
                                             conn.value );
                    }
View Full Code Here

Examples of org.drools.guvnor.client.modeldriven.brl.ConnectiveConstraint

    y.constraintList.constraints = cons;
    cons[0] = new SingleFieldConstraint("age");
    cons[1] = new SingleFieldConstraint("make");
    cons[0].fieldBinding = "qbc";
    cons[0].connectives = new ConnectiveConstraint[1];
    cons[0].connectives[0] = new ConnectiveConstraint("&", "x");
    cons[0].connectives[0].constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;

    final FactPattern other = new FactPattern("House");
    model.lhs[2] = other;
    other.boundName = "q";
View Full Code Here

Examples of org.drools.guvnor.models.commons.shared.rule.ConnectiveConstraint

                }

                // and now do the connectives.
                if ( constr.getConnectives() != null ) {
                    for ( int j = 0; j < constr.getConnectives().length; j++ ) {
                        final ConnectiveConstraint conn = constr.getConnectives()[ j ];

                        parameters = null;
                        if ( conn instanceof HasParameterizedOperator ) {
                            HasParameterizedOperator hop = (HasParameterizedOperator) conn;
                            parameters = hop.getParameters();
                        }

                        addFieldRestriction( buf,
                                             conn.getConstraintValueType(),
                                             conn.getFieldType(),
                                             conn.getOperator(),
                                             parameters,
                                             conn.getValue(),
                                             conn.getExpressionValue() );
                    }
                }

            }
        }
View Full Code Here

Examples of org.drools.guvnor.models.commons.shared.rule.ConnectiveConstraint

                    for ( int i = 0; i < connectiveConstraints.length; i++ ) {
                        String constraint = splittedValue[ i + 1 ].trim();
                        String connectiveOperator = findOperator( constraint );
                        String connectiveValue = constraint.substring( connectiveOperator.length() ).trim();

                        connectiveConstraints[ i ] = new ConnectiveConstraint();
                        connectiveConstraints[ i ].setOperator( ( isAnd ? "&& " : "|| " ) + connectiveOperator );
                        setValueOnConstraint( operator, connectiveConstraints[ i ], connectiveValue );
                    }
                    con.setConnectives( connectiveConstraints );
                }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

        String valueType;
        if ( constraint instanceof SingleFieldConstraintEBLeftSide ) {
            SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) constraint;
            valueType = sfexp.getExpressionLeftSide().getGenericType();
        } else if ( constraint instanceof ConnectiveConstraint ) {
            ConnectiveConstraint cc = (ConnectiveConstraint) constraint;
            valueType = cc.getFieldType();
        } else {
            valueType = sce.getFieldType( pattern.getFactType(),
                                          fieldName );
        }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

            SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) con;
            this.fieldName = sfexp.getExpressionLeftSide().getFieldName();
            this.fieldType = sfexp.getExpressionLeftSide().getGenericType();

        } else if ( con instanceof ConnectiveConstraint ) {
            ConnectiveConstraint cc = (ConnectiveConstraint) con;
            this.fieldName = cc.getFieldName();
            this.fieldType = cc.getFieldType();

        } else {
            this.fieldName = fieldName;
            this.fieldType = sce.getFieldType( pattern.getFactType(),
                                               fieldName );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

            SingleFieldConstraint sfc = (SingleFieldConstraint) con;
            if ( sfc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( sfc.getOperator() );
            }
        } else if ( con instanceof ConnectiveConstraint ) {
            ConnectiveConstraint cc = (ConnectiveConstraint) con;
            if ( cc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( cc.getOperator() );
            }
        }

        if ( showLiteralOrFormula ) {
            form.addAttribute( constants.LiteralValue() + ":",
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        fp0.addConstraint( sfc0 );

        sfc0.addNewConnective();
        ConnectiveConstraint sfc0cc0 = sfc0.connectives[0];
        sfc0cc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0cc0.setFieldName( "sfc0" );
        sfc0cc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0cc0.setOperator( "|| ==" );
        sfc0cc0.setParameter( "sfc0cc0p0",
                              "sfc0cc0p0Value" );
        sfc0cc0.setValue( "sfc0cc0Value" );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) clone.lhs[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( 1,
                      fp0Clone.constraintList.constraints.length );

        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc0Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[0];
        assertEquals( sfc0.getConstraintValueType(),
                      sfc0Clone.getConstraintValueType() );
        assertEquals( sfc0.getFieldBinding(),
                      sfc0Clone.getFieldBinding() );
        assertEquals( sfc0.getFieldName(),
                      sfc0Clone.getFieldName() );
        assertEquals( sfc0.getFieldType(),
                      sfc0Clone.getFieldType() );
        assertEquals( sfc0.getOperator(),
                      sfc0Clone.getOperator() );
        assertNotNull( sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getParameter( "sfc0p0" ),
                      sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getValue(),
                      sfc0Clone.getValue() );

        assertEquals( sfc0.connectives.length,
                      sfc0Clone.connectives.length );
        assertNotSame( sfc0.connectives[0],
                       sfc0Clone.connectives[0] );
        assertNotNull( sfc0Clone.connectives[0] );
        assertTrue( sfc0Clone.connectives[0] instanceof ConnectiveConstraint );
        ConnectiveConstraint sfc0cc0Clone = (ConnectiveConstraint) sfc0Clone.connectives[0];
        assertEquals( sfc0cc0.getConstraintValueType(),
                      sfc0cc0Clone.getConstraintValueType() );
        assertEquals( sfc0cc0.getFieldName(),
                      sfc0cc0Clone.getFieldName() );
        assertEquals( sfc0cc0.getFieldType(),
                      sfc0cc0Clone.getFieldType() );
        assertEquals( sfc0cc0.getOperator(),
                      sfc0cc0Clone.getOperator() );
        assertNotNull( sfc0cc0Clone.getParameter( "sfc0cc0p0" ) );
        assertEquals( sfc0cc0.getParameter( "sfc0cc0p0" ),
                      sfc0cc0Clone.getParameter( "sfc0cc0p0" ) );
        assertEquals( sfc0cc0.getValue(),
                      sfc0cc0Clone.getValue() );
    }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

        if ( c.connectives != null && c.connectives.length > 0 ) {
            hp.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
            hp.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
            for ( int i = 0; i < c.connectives.length; i++ ) {

                ConnectiveConstraint con = c.connectives[i];

                hp.add( connectiveOperatorDropDown( con,
                                                    c.getFieldName() ) );
                hp.add( connectiveValueEditor( con,
                                               factClass,
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ConnectiveConstraint

                }

                // and now do the connectives.
                if ( constr.connectives != null ) {
                    for ( int j = 0; j < constr.connectives.length; j++ ) {
                        final ConnectiveConstraint conn = constr.connectives[j];

                        parameters = null;
                        if ( conn instanceof HasParameterizedOperator ) {
                            HasParameterizedOperator hop = (HasParameterizedOperator) conn;
                            parameters = hop.getParameters();
                        }

                        addFieldRestriction( buf,
                                             conn.getConstraintValueType(),
                                             conn.getFieldType(),
                                             conn.getOperator(),
                                             parameters,
                                             conn.getValue(),
                                             conn.getExpressionValue() );
                    }
                }

            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.