Examples of VariableRestriction


Examples of org.drools.verifier.components.VariableRestriction

     */
    private void visit(VariableRestrictionDescr descr) {

        Variable variable = data.getVariableByRuleAndVariableName( pattern.getRuleName(),
                                                                   descr.getIdentifier() );
        VariableRestriction restriction = new VariableRestriction( pattern );

        restriction.setPatternIsNot( pattern.isPatternNot() );
        restriction.setConstraintPath( constraint.getPath() );
        restriction.setFieldPath( constraint.getFieldPath() );
        restriction.setOperator( Operator.determineOperator( descr.getEvaluator(),
                                                             descr.isNegated() ) );
        restriction.setVariable( variable );
        restriction.setOrderNumber( orderNumber );
        restriction.setParentPath( pattern.getPath() );
        restriction.setParentType( pattern.getVerifierComponentType() );

        // Set field value, if it is unset.
        field.setFieldType( Field.VARIABLE );

        data.add( restriction );
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        pp1.add( r1 );
        pp1.add( r2 );

        Restriction r3 = new VariableRestriction( pattern1 );
        Restriction r4 = new VariableRestriction( pattern1 );
        Opposites o2 = new Opposites( r1,
                                      r2 );
        SubPattern pp2 = new SubPattern( pattern1,
                                         1 );
        pp2.add( r1 );
        pp2.add( r2 );

        // This pattern is okay.
        Pattern pattern2 = VerifierComponentMockFactory.createPattern2();

        Restriction r5 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        Restriction r6 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        SubPattern pp3 = new SubPattern( pattern2,
                                         0 );
        pp3.add( r5 );
        pp3.add( r6 );

        Restriction r7 = new VariableRestriction( pattern2 );
        Restriction r8 = new VariableRestriction( pattern2 );
        Opposites o4 = new Opposites( r7,
                                      r8 );
        SubPattern pp4 = new SubPattern( pattern2,
                                         1 );
        pp4.add( r7 );
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

                                                                           "" ) );
        saveVerifierComponentAndGet( new EnumRestriction( pattern ) );
        saveVerifierComponentAndGet( new QualifiedIdentifierRestriction( pattern ) );
        saveVerifierComponentAndGet( new ReturnValueRestriction( pattern ) );
        saveVerifierComponentAndGet( new ReturnValueRestriction( pattern ) );
        saveVerifierComponentAndGet( new VariableRestriction( pattern ) );
    }
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

  private void flatten(VariableRestrictionDescr descr,
      VerifierComponent parent, int orderNumber) {

    Variable variable = data.getVariableByRuleAndVariableName(currentRule
        .getRuleName(), descr.getIdentifier());
    VariableRestriction restriction = new VariableRestriction();

    restriction.setRuleId(currentRule.getId());
    restriction.setRuleName(currentRule.getRuleName());
    restriction.setPatternId(currentPattern.getId());
    restriction.setPatternIsNot(currentPattern.isPatternNot());
    restriction.setConstraintId(currentConstraint.getId());
    restriction.setFieldId(currentConstraint.getFieldId());
    restriction.setOperator(Operator.determineOperator(
        descr.getEvaluator(), descr.isNegated()));
    restriction.setVariable(variable);
    restriction.setOrderNumber(orderNumber);
    restriction.setParent(parent);

    // Set field value, if it is unset.
    currentField.setFieldType(Field.FieldType.VARIABLE);

    data.add(restriction);
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

     */
    private void visit(VariableRestrictionDescr descr) {

        PatternVariable patternVariable = (PatternVariable) data.getVariableByRuleAndVariableName(pattern.getRuleName(),
                descr.getIdentifier());
        VariableRestriction restriction = new VariableRestriction(pattern);

        restriction.setPatternIsNot(pattern.isPatternNot());
        restriction.setFieldPath(field.getPath());
        restriction.setOperator(Operator.determineOperator(descr.getEvaluator(),
                descr.isNegated()));
        restriction.setVariable(patternVariable);
        restriction.setOrderNumber(orderNumber);
        restriction.setParentPath(pattern.getPath());
        restriction.setParentType(pattern.getVerifierComponentType());

        // Set field value, if it is unset.
        field.setFieldType(Field.VARIABLE);

        data.add(restriction);
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

        return expression.charAt(0) == character && expression.charAt(expression.length() - 1) == character;
    }

    private void createVariableRestriction(int orderNumber, String value, Operator operator) {
        Variable variable = data.getVariableByRuleAndVariableName(pattern.getRuleName(), value);
        VariableRestriction restriction = new VariableRestriction(pattern);

        restriction.setPatternIsNot(pattern.isPatternNot());
        restriction.setFieldPath(field.getPath());
        restriction.setOperator(operator);
        restriction.setVariable(variable);
        restriction.setOrderNumber(orderNumber);
        restriction.setParentPath(pattern.getPath());
        restriction.setParentType(pattern.getVerifierComponentType());

        // Set field value, if it is unset.
        field.setFieldType(Field.VARIABLE);

        data.add(restriction);
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

                                                                           "" ) );
        saveVerifierComponentAndGet( new EnumRestriction( pattern ) );
        saveVerifierComponentAndGet( new QualifiedIdentifierRestriction( pattern ) );
        saveVerifierComponentAndGet( new ReturnValueRestriction( pattern ) );
        saveVerifierComponentAndGet( new ReturnValueRestriction( pattern ) );
        saveVerifierComponentAndGet( new VariableRestriction( pattern ) );
    }
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        pp1.add( r1 );
        pp1.add( r2 );

        Restriction r3 = new VariableRestriction( pattern1 );
        Restriction r4 = new VariableRestriction( pattern1 );
        Opposites o2 = new Opposites( r1,
                                      r2 );
        SubPattern pp2 = new SubPattern( pattern1,
                                         1 );
        pp2.add( r1 );
        pp2.add( r2 );

        // This pattern is okay.
        Pattern pattern2 = VerifierComponentMockFactory.createPattern2();

        Restriction r5 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        Restriction r6 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        SubPattern pp3 = new SubPattern( pattern2,
                                         0 );
        pp3.add( r5 );
        pp3.add( r6 );

        Restriction r7 = new VariableRestriction( pattern2 );
        Restriction r8 = new VariableRestriction( pattern2 );
        Opposites o4 = new Opposites( r7,
                                      r8 );
        SubPattern pp4 = new SubPattern( pattern2,
                                         1 );
        pp4.add( r7 );
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

        Variable variable1 = new Variable( rule );
        variable1.setObjectTypePath( "0" );
        variable1.setObjectTypeType( VerifierComponentType.FIELD.getType() );
        variable1.setOrderNumber( 11 );

        VariableRestriction r1 = new VariableRestriction( pattern1 );
        r1.setOperator( Operator.GREATER );
        r1.setFieldPath( "0" );
        r1.setVariable( variable1 );
        r1.setOrderNumber( 0 );

        VariableRestriction r2 = new VariableRestriction( pattern1 );
        r2.setOperator( Operator.LESS );
        r2.setFieldPath( "0" );
        r2.setVariable( variable1 );
        r2.setOrderNumber( 1 );

        /*
         * Pair that doesn't work.
         */
        Variable variable2 = new Variable( rule );
        variable2.setObjectTypePath( "1" );
        variable2.setObjectTypeType( VerifierComponentType.FIELD.getType() );
        variable2.setOrderNumber( 10 );

        VariableRestriction r3 = new VariableRestriction( pattern2 );
        r3.setOperator( Operator.GREATER_OR_EQUAL );
        r3.setFieldPath( "1" );
        r3.setVariable( variable2 );
        r3.setOrderNumber( 0 );

        VariableRestriction r4 = new VariableRestriction( pattern2 );
        r4.setOperator( Operator.EQUAL );
        r4.setFieldPath( "1" );
        r4.setVariable( variable2 );
        r4.setOrderNumber( 1 );

        data.add( r1 );
        data.add( r2 );
        data.add( r3 );
        data.add( r4 );
View Full Code Here

Examples of org.drools.verifier.components.VariableRestriction

        Variable variable1 = new Variable( rule );
        variable1.setObjectTypePath( "1" );
        variable1.setObjectTypeType( VerifierComponentType.FIELD.getType() );
        variable1.setOrderNumber( -1 );

        VariableRestriction r1 = new VariableRestriction( pattern1 );
        r1.setFieldPath( "0" );
        r1.setOperator( Operator.GREATER_OR_EQUAL );
        r1.setVariable( variable1 );
        r1.setOrderNumber( 0 );

        VariableRestriction r2 = new VariableRestriction( pattern1 );
        r2.setFieldPath( "0" );
        r2.setOperator( Operator.LESS );
        r2.setVariable( variable1 );
        r2.setOrderNumber( 1 );

        String containsOperator = "contains";

        Variable variable2 = new Variable( rule );
        variable2.setObjectTypePath( "2" );
        variable2.setObjectTypeType( VerifierComponentType.FIELD.getType() );
        variable2.setOrderNumber( 3 );

        VariableRestriction r3 = new VariableRestriction( pattern2 );
        r3.setFieldPath( "1" );
        r3.setOperator( Operator.determineOperator( containsOperator,
                                                    false ) );
        r3.setVariable( variable2 );
        r3.setOrderNumber( 4 );

        VariableRestriction r4 = new VariableRestriction( pattern2 );
        r4.setFieldPath( "1" );
        r4.setOperator( Operator.determineOperator( containsOperator,
                                                    true ) );
        r4.setVariable( variable2 );
        r4.setOrderNumber( 5 );

        /*
         * Pair that doesn't work.
         */
        Variable variable3 = new Variable( rule );
        variable3.setObjectTypePath( "3" );
        variable3.setObjectTypeType( VerifierComponentType.FIELD.getType() );
        variable3.setOrderNumber( 6 );

        VariableRestriction r5 = new VariableRestriction( pattern3 );
        r5.setFieldPath( "1" );
        r5.setOperator( Operator.GREATER_OR_EQUAL );
        r5.setVariable( variable3 );
        r5.setOrderNumber( 7 );

        VariableRestriction r6 = new VariableRestriction( pattern3 );
        r6.setFieldPath( "1" );
        r6.setOperator( Operator.EQUAL );
        r6.setVariable( variable3 );
        r6.setOrderNumber( 8 );

        data.add( r1 );
        data.add( r2 );
        data.add( r3 );
        data.add( r4 );
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.