Package org.drools.verifier.components

Examples of org.drools.verifier.components.Restriction$RestrictionType


            patternsByObjectTypeId.put( pattern.getObjectTypePath(),
                                        pattern );
            patternsByRuleName.put( pattern.getRuleName(),
                                    pattern );
        } else if ( VerifierComponentType.RESTRICTION.equals( object.getVerifierComponentType() ) ) {
            Restriction restriction = (Restriction) object;

            restrictionsByFieldId.put( restriction.getFieldPath(),
                                       restriction );
        } else if ( VerifierComponentType.RULE_PACKAGE.equals( object.getVerifierComponentType() ) ) {
            RulePackage rulePackage = (RulePackage) object;

            packagesByName.put( rulePackage.getName(),
View Full Code Here


        VerifierRule rule = new VerifierRule( rulePackage );
        rule.setName( "testRule" );
        Pattern pattern = new Pattern( rule );

        Restriction r = LiteralRestriction.createRestriction( pattern,
                                                              "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        Restriction r3 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        Restriction r4 = LiteralRestriction.createRestriction( pattern,
                                                               "" );

        Solvers solvers = new Solvers();

        solvers.startRuleSolver( rule );
View Full Code Here

    public void testBasicAnd() {

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        Pattern pattern = VerifierComponentMockFactory.createPattern1();

        Restriction r = LiteralRestriction.createRestriction( pattern,
                                                              "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern,
                                                               "" );

        Solvers solvers = new Solvers();

        solvers.startRuleSolver( rule );
View Full Code Here

        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        SubPattern pp2 = new SubPattern( pattern2,
                                         0 );

        Restriction r1 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        pp1.add( r1 );

        Restriction r2 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        pp2.add( r2 );

        Restriction r3 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        pp1.add( r3 );

        Restriction r4 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        pp2.add( r4 );

        Incompatibility o1 = new Incompatibility( r1,
                                                  r2 );
        Incompatibility o2 = new Incompatibility( r3,
                                                  r4 );

        Pattern pattern3 = VerifierComponentMockFactory.createPattern( 3 );
        Pattern pattern4 = VerifierComponentMockFactory.createPattern( 4 );
        /*
         * Another working pair.
         */
        SubPattern pp3 = new SubPattern( pattern3,
                                         0 );
        SubPattern pp4 = new SubPattern( pattern4,
                                         0 );

        Restriction r5 = LiteralRestriction.createRestriction( pattern3,
                                                               "" );
        pp3.add( r5 );

        Restriction r6 = LiteralRestriction.createRestriction( pattern4,
                                                               "" );
        pp4.add( r6 );

        Restriction r7 = LiteralRestriction.createRestriction( pattern3,
                                                               "" );
        pp3.add( r7 );

        Restriction r8 = LiteralRestriction.createRestriction( pattern4,
                                                               "" );
        pp4.add( r8 );

        Incompatibility o3 = new Incompatibility( r5,
                                                  r6 );
View Full Code Here

                           result );

        // This pattern has an error.
        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();

        Restriction r1 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Incompatibility i1 = new Incompatibility( r1,
                                                  r2 );
        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        pp1.add( r1 );
        pp1.add( r2 );

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

        // This pattern does not have an error.
        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 );
        Incompatibility i4 = new Incompatibility( r7,
                                                  r8 );
        SubPattern pp4 = new SubPattern( pattern2,
                                         1 );
        pp4.add( r7 );
View Full Code Here

        SubPattern pp1 = new SubPattern( pattern,
                                         0 );
        SubPattern pp2 = new SubPattern( pattern,
                                         1 );

        Restriction r1 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp1.add( r1 );

        Restriction r2 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp2.add( r2 );

        Restriction r3 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp1.add( r3 );

        Restriction r4 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp2.add( r4 );

        Opposites o1 = new Opposites( r1,
                                      r2 );
        Opposites o2 = new Opposites( r3,
                                      r4 );

        /*
         * Pair that doesn't work.
         */
        SubPattern pp3 = new SubPattern( pattern,
                                         2 );
        SubPattern pp4 = new SubPattern( pattern,
                                         3 );

        Restriction r5 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp3.add( r5 );

        Restriction r6 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp4.add( r6 );

        Restriction r7 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp3.add( r7 );

        Restriction r8 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        pp4.add( r8 );

        Opposites o3 = new Opposites( r5,
                                      r6 );
View Full Code Here

                           result );

        // This pattern is always true.
        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();

        Restriction r1 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Opposites o1 = new Opposites( r1,
                                      r2 );
        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

            patternsByObjectTypeId.put( pattern.getObjectTypePath(),
                                        pattern );
            patternsByRuleName.put( pattern.getRuleName(),
                                    pattern );
        } else if ( VerifierComponentType.RESTRICTION.equals( object.getVerifierComponentType() ) ) {
            Restriction restriction = (Restriction) object;

            restrictionsByFieldId.put( restriction.getFieldPath(),
                                       restriction );
        } else if ( VerifierComponentType.RULE_PACKAGE.equals( object.getVerifierComponentType() ) ) {
            RulePackage rulePackage = (RulePackage) object;

            packagesByName.put( rulePackage.getName(),
View Full Code Here

        VerifierRule rule = new VerifierRule(descr, rulePackage, new HashMap<String, Object>());
        rule.setName( "testRule" );
        Pattern pattern = new Pattern(new PatternDescr(), rule );

        Restriction r = LiteralRestriction.createRestriction( pattern,
                                                              "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        Restriction r3 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        Restriction r4 = LiteralRestriction.createRestriction( pattern,
                                                               "" );
        Solvers solvers = new Solvers();

        solvers.startRuleSolver( rule );
View Full Code Here

    public void testBasicAnd() {

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        Pattern pattern = VerifierComponentMockFactory.createPattern1();

        Restriction r = LiteralRestriction.createRestriction( pattern,
                                                              "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern,
                                                               "" );

        Solvers solvers = new Solvers();

        solvers.startRuleSolver( rule );
View Full Code Here

TOP

Related Classes of org.drools.verifier.components.Restriction$RestrictionType

Copyright © 2018 www.massapicom. 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.