Package org.drools.workbench.models.commons.backend.rule.context

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( ") || hasNonTemplateOutput" ).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


        @Override
        public void postGenerateNestedConnector( 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

            if ( isDSLEnhanced ) {
                // adding passthrough markup
                buf.append( ">" );
            }

            final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                               pattern );
            preGeneratePattern( gctx );

            generateFactPattern( pattern,
                                 gctx );
View Full Code Here

                // adding passthrough markup
                buf.append( ">" );
            }

            if ( pattern.getFactPattern() != null ) {
                final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                                   pattern.getFactPattern() );
                generateFactPattern( pattern.getFactPattern(),
                                     gctx );

                buf.append( " from " );
View Full Code Here

                // adding passthrough markup
                buf.append( ">" );
            }

            if ( pattern.getFactPattern() != null ) {
                final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                                   pattern.getFactPattern() );
                generateFactPattern( pattern.getFactPattern(),
                                     gctx );

                buf.append( " from collect ( " );
View Full Code Here

                // adding passthrough markup
                buf.append( ">" );
            }

            if ( pattern.getFactPattern() != null ) {
                final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                                   pattern.getFactPattern() );
                generateFactPattern( pattern.getFactPattern(),
                                     gctx );

                buf.append( " from accumulate ( " );
                if ( pattern.getSourcePattern() != null ) {
                    if ( pattern.getSourcePattern() instanceof FactPattern ) {
                        final LHSGeneratorContext soucrceGctx = generatorContextFactory.newGeneratorContext();
                        generateFactPattern( (FactPattern) pattern.getSourcePattern(),
                                             soucrceGctx );

                    } else if ( pattern.getSourcePattern() instanceof FromAccumulateCompositeFactPattern ) {
                        visitFromAccumulateCompositeFactPattern( (FromAccumulateCompositeFactPattern) pattern.getSourcePattern(),
View Full Code Here

                // adding passthrough markup
                buf.append( ">" );
            }

            if ( pattern.getFactPattern() != null ) {
                final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                                   pattern.getFactPattern() );
                generateFactPattern( pattern.getFactPattern(),
                                     gctx );
                buf.append( " from entry-point \"" + pattern.getEntryPointName() + "\"\n" );
            }
View Full Code Here

            if ( pattern.getPatterns() == null || pattern.getPatterns().length == 0 ) {
                return;
            }
            IFactPattern subPattern = pattern.getPatterns()[ subIndex ];
            if ( subPattern instanceof FactPattern ) {
                final LHSGeneratorContext gctx = generatorContextFactory.newChildGeneratorContext( rootContext,
                                                                                                   subPattern );
                this.generateFactPattern( (FactPattern) subPattern,
                                          gctx );

            } else if ( subPattern instanceof FromAccumulateCompositeFactPattern ) {
View Full Code Here

            }
        }

        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

                               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

TOP

Related Classes of org.drools.workbench.models.commons.backend.rule.context.LHSGeneratorContext

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.