Examples of LHSGeneratorContext


Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

            }
        }

        private void generateConstraints( final FactPattern pattern,
                                          final LHSGeneratorContext parentContext ) {
            LHSGeneratorContext gctx = null;
            for ( int constraintIndex = 0; constraintIndex < pattern.getFieldConstraints().length; constraintIndex++ ) {
                FieldConstraint constr = pattern.getConstraintList().getConstraints()[ constraintIndex ];

                if ( constraintIndex == 0 ) {
                    gctx = generatorContextFactory.newChildGeneratorContext( parentContext,
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

                               parentContext );
            if ( con instanceof CompositeFieldConstraint ) {
                CompositeFieldConstraint cfc = (CompositeFieldConstraint) con;
                FieldConstraint[] nestedConstraints = cfc.getConstraints();
                if ( nestedConstraints != null ) {
                    LHSGeneratorContext nestedGctx = generatorContextFactory.newChildGeneratorContext( parentContext,
                                                                                                       con );
                    preGenerateNestedConstraint( nestedGctx );
                    if ( parentContext.getParent().getFieldConstraint() instanceof CompositeFieldConstraint ) {
                        buf.append( "( " );
                    }
                    LHSGeneratorContext gctx = null;
                    for ( int nestedConstraintIndex = 0; nestedConstraintIndex < nestedConstraints.length; nestedConstraintIndex++ ) {
                        FieldConstraint nestedConstr = nestedConstraints[ nestedConstraintIndex ];

                        if ( nestedConstraintIndex == 0 ) {
                            gctx = generatorContextFactory.newChildGeneratorContext( nestedGctx,
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

        }

        private void generateConnectiveFieldRestriction( final SingleFieldConstraint constr,
                                                         final Map<String, String> parameters,
                                                         final LHSGeneratorContext gctx ) {
            LHSGeneratorContext cctx = generatorContextFactory.newChildGeneratorContext( gctx,
                                                                                         constr );
            if ( constr instanceof SingleFieldConstraintEBLeftSide ) {
                SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) constr;
                addConnectiveFieldRestriction( buf,
                                               sfexp.getConstraintValueType(),
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

                buf.append( buildOperatorParameterDRL( window.getParameters() ) );
            }
        }

        private void generateConstraints( final FactPattern pattern ) {
            LHSGeneratorContext gctx = generatorContextFactory.newGeneratorContext();
            preGenerateConstraints( gctx );
            for ( int constraintIndex = 0; constraintIndex < pattern.getFieldConstraints().length; constraintIndex++ ) {
                FieldConstraint constr = pattern.getConstraintList().getConstraints()[ constraintIndex ];
                gctx.setFieldConstraint( constr );
                generateConstraint( constr,
                                    gctx );
            }
        }
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

                               gctx );
            if ( con instanceof CompositeFieldConstraint ) {
                CompositeFieldConstraint cfc = (CompositeFieldConstraint) con;
                FieldConstraint[] nestedConstraints = cfc.getConstraints();
                if ( nestedConstraints != null ) {
                    LHSGeneratorContext nestedGctx = generatorContextFactory.newChildGeneratorContext( gctx );
                    preGenerateConstraints( nestedGctx );
                    preGenerateNestedConstraint( gctx );
                    if ( gctx.getDepth() > 0 ) {
                        buf.append( "( " );
                    }
                    for ( int nestedConstraintIndex = 0; nestedConstraintIndex < nestedConstraints.length; nestedConstraintIndex++ ) {
                        FieldConstraint nestedConstr = nestedConstraints[ nestedConstraintIndex ];
                        nestedGctx.setFieldConstraint( nestedConstr );
                        generateConstraint( nestedConstr,
                                            nestedGctx );
                    }
                    gctx.setHasOutput( nestedGctx.isHasOutput() );
                    if ( gctx.getDepth() > 0 ) {
                        buf.append( ")" );
                    }
                    postGenerateNestedConstraint( gctx );
                }
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

        }

        private void generateConnectiveFieldRestriction( final SingleFieldConstraint constr,
                                                         final Map<String, String> parameters,
                                                         final LHSGeneratorContext gctx ) {
            LHSGeneratorContext cctx = generatorContextFactory.newChildGeneratorContext( gctx );
            preGenerateConstraints( cctx );
            cctx.setFieldConstraint( constr );
            if ( constr instanceof SingleFieldConstraintEBLeftSide ) {
                SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) constr;
                addConnectiveFieldRestriction( buf,
                                               sfexp.getConstraintValueType(),
                                               sfexp.getExpressionLeftSide().getGenericType(),
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

                for ( String var : gctx.getVarsInScope() ) {
                    buf.append( var + " != empty || " );
                }
                buf.delete( buf.length() - 4, buf.length() );

                LHSGeneratorContext parentContext = gctx.getParent();
                if ( parentContext != null ) {
                    Set<String> parentVarsInScope = new HashSet<String>( parentContext.getVarsInScope() );
                    parentVarsInScope.removeAll( gctx.getVarsInScope() );
                    if ( parentVarsInScope.size() > 0 ) {
                        buf.append( ") && !(" );
                        for ( String var : parentVarsInScope ) {
                            buf.append( var + " == empty && " );
                        }
                        buf.delete( buf.length() - 4, buf.length() );
                    }
                }
                buf.append( ") || hasLHSNonTemplateOutput" ).append( gctx.getDepth() + "_" + gctx.getOffset() ).append( "}" );
            } else {
                LHSGeneratorContext parentContext = gctx.getParent();
                if ( parentContext != null ) {
                    Set<String> parentVarsInScope = new HashSet<String>( parentContext.getVarsInScope() );
                    parentVarsInScope.removeAll( gctx.getVarsInScope() );
                    if ( parentVarsInScope.size() > 0 ) {
                        buf.append( "@if{!(" );
                        for ( String var : parentVarsInScope ) {
                            buf.append( var + " == empty || " );
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

        @Override
        protected void postGenerateNestedConnector( final LHSGeneratorContext gctx ) {
            if ( gctx.getVarsInScope().size() > 0 ) {
                buf.append( "@end{}" );
            } else {
                LHSGeneratorContext parentContext = gctx.getParent();
                if ( parentContext != null ) {
                    Set<String> parentVarsInScope = new HashSet<String>( parentContext.getVarsInScope() );
                    parentVarsInScope.removeAll( gctx.getVarsInScope() );
                    if ( parentVarsInScope.size() > 0 ) {
                        buf.append( "@end{}" );
                    }
                }
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

            boolean generateTemplateCheck = isTemplateKey( constr );
            if ( generateTemplateCheck ) {
                buf.append( "@if{(" );
                buf.append( "hasLHSOutput" + gctx.getDepth() + "_" + gctx.getOffset() ).append( " && (" );
                for ( int i = 0; i < peers.size(); i++ ) {
                    final LHSGeneratorContext peer = peers.get( i );
                    buf.append( "hasLHSOutput" + peer.getDepth() + "_" + peer.getOffset() );
                    buf.append( ( i < peers.size() - 1 ? " || " : ")" ) );
                }
                buf.append( ")}" );
            }
View Full Code Here

Examples of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

                buf.append( buildOperatorParameterDRL( window.getParameters() ) );
            }
        }

        private void generateConstraints( final FactPattern pattern ) {
            LHSGeneratorContext gctx = generatorContextFactory.newGeneratorContext();
            preGenerateConstraints( gctx );
            for ( int constraintIndex = 0; constraintIndex < pattern.getFieldConstraints().length; constraintIndex++ ) {
                FieldConstraint constr = pattern.getConstraintList().getConstraints()[ constraintIndex ];
                gctx.setFieldConstraint( constr );
                generateConstraint( constr,
                                    gctx );
            }
        }
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.