Examples of BoundIdentifiers


Examples of org.drools.compiler.BoundIdentifiers

        final String className = "action" + context.getNextId();              

        JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
       
        Map<String, Class<?>> variables = new HashMap<String,Class<?>>();
        BoundIdentifiers boundIdentifiers = new BoundIdentifiers(variables, context.getPackageBuilder().getGlobals());
        AnalysisResult analysis = dialect.analyzeBlock( context,
                                                        actionDescr,
                                                        actionDescr.getText(),
                                                        boundIdentifiers);
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

            boolean typeSafe = context.isTypesafe();
           
            Map<String, Class<?>> variables = new HashMap<String,Class<?>>();
           
            context.setTypesafe( false ); // we can't know all the types ahead of time with processes, but we don't need return types, so it's ok
            BoundIdentifiers boundIdentifiers = new BoundIdentifiers(variables, context.getPackageBuilder().getGlobals());
            MVELAnalysisResult analysis = ( MVELAnalysisResult ) dialect.analyzeBlock( context,
                                                                                       descr,
                                                                                       dialect.getInterceptors(),
                                                                                       text,
                                                                                       boundIdentifiers,
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

            boolean typeSafe = context.isTypesafe();
           
            Map<String, Class<?>> variables = new HashMap<String,Class<?>>();
           
            context.setTypesafe( false ); // we can't know all the types ahead of time with processes, but we don't need return types, so it's ok
            BoundIdentifiers boundIdentifiers = new BoundIdentifiers(variables, context.getPackageBuilder().getGlobals());
            MVELAnalysisResult analysis = ( MVELAnalysisResult ) dialect.analyzeBlock( context,
                                                                                       actionDescr,
                                                                                       dialect.getInterceptors(),
                                                                                       text,
                                                                                       boundIdentifiers,
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        final String className = "returnValueEvaluator" + context.getNextId();

        JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
       
        Map<String, Class<?>> variables = new HashMap<String,Class<?>>();
        BoundIdentifiers boundIdentifiers = new BoundIdentifiers(variables, context.getPackageBuilder().getGlobals());
        AnalysisResult analysis = dialect.analyzeBlock( context,
                                                        descr,
                                                        descr.getText(),
                                                        boundIdentifiers);
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        Map<String, Declaration> decls = context.getDeclarationResolver().getDeclarations( context.getRule() );

        AnalysisResult analysis = context.getDialect().analyzeExpression( context,
                                                                          evalDescr,
                                                                          evalDescr.getContent(),
                                                                          new BoundIdentifiers( context.getDeclarationResolver().getDeclarationClasses(decls),
                                                                                                context.getPackageBuilder().getGlobals() ) );

        final Declaration[] declarations = decls.values().toArray( new Declaration[decls.size()]);
        return buildEval(context, evalDescr, analysis, declarations);
     }
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        registerInvokerBytecode(context, vars, bytecode, eval);
        return eval;
    }

    private Declaration[] getUsedDeclarations(RuleBuildContext context, Pattern pattern, AnalysisResult analysis) {
        BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();
        final List<Declaration> declarations = new ArrayList<Declaration>();

        for ( String id : usedIdentifiers.getDeclrClasses().keySet() ) {
            declarations.add( context.getDeclarationResolver().getDeclaration( context.getRule(), id ) );
        }

        createImplicitBindings( context,
                                pattern,
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        Map<String, Class< ? >> globals = context.getPackageBuilder().getGlobals();
        AnalysisResult analysis = context.getDialect().analyzeExpression( context,
                returnValueRestrictionDescr,
                returnValueRestrictionDescr.getContent(),
                new BoundIdentifiers( declarationsMap,
                        globals,
                        null,
                        thisClass ) );
        if ( analysis == null ) {
            // something bad happened
            return null;
        }
        final BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();

        final List<Declaration> tupleDeclarations = new ArrayList<Declaration>();
        final List<Declaration> factDeclarations = new ArrayList<Declaration>();
        for ( String id : usedIdentifiers.getDeclrClasses().keySet() ) {
            final Declaration decl = context.getDeclarationResolver().getDeclaration( context.getRule(), id );
            if ( decl.getPattern() == pattern ) {
                factDeclarations.add( decl );
            } else {
                tupleDeclarations.add( decl );
            }
        }
        createImplicitBindings( context,
                pattern,
                analysis.getNotBoundedIdentifiers(),
                usedIdentifiers,
                factDeclarations );

        final Declaration[] previousDeclarations = tupleDeclarations.toArray( new Declaration[tupleDeclarations.size()] );
        final Declaration[] localDeclarations = factDeclarations.toArray( new Declaration[factDeclarations.size()] );

        Arrays.sort( previousDeclarations,
                SortDeclarations.instance );
        Arrays.sort( localDeclarations,
                SortDeclarations.instance );

        final String[] requiredGlobals = usedIdentifiers.getGlobals().keySet().toArray( new String[usedIdentifiers.getGlobals().size()] );

        Declaration[] requiredDeclarations = new Declaration[previousDeclarations.length + localDeclarations.length];
        System.arraycopy( previousDeclarations,
                0,
                requiredDeclarations,
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        Declaration[][] usedDeclarations = getUsedDeclarations(context, pattern, analysis);
        Declaration[] previousDeclarations = usedDeclarations[0];
        Declaration[] localDeclarations = usedDeclarations[1];

        BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();
        String[] requiredGlobals = usedIdentifiers.getGlobals().keySet().toArray( new String[usedIdentifiers.getGlobals().size()] );
        String[] requiredOperators = usedIdentifiers.getOperators().keySet().toArray( new String[usedIdentifiers.getOperators().size()] );

        Arrays.sort( previousDeclarations,
                     SortDeclarations.instance );
        Arrays.sort( localDeclarations,
                     SortDeclarations.instance );
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

            pattern.addConstraint( constraint );
        }
    }

    public static Declaration[][] getUsedDeclarations(RuleBuildContext context, Pattern pattern, AnalysisResult analysis) {
        BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();
        final List<Declaration> tupleDeclarations = new ArrayList<Declaration>();
        final List<Declaration> factDeclarations = new ArrayList<Declaration>();

        for ( String id : usedIdentifiers.getDeclrClasses().keySet() ) {
            final Declaration decl = context.getDeclarationResolver().getDeclaration( context.getRule(), id );
            if ( decl.getPattern() == pattern ) {
                factDeclarations.add( decl );
            } else {
                tupleDeclarations.add( decl );
View Full Code Here

Examples of org.drools.compiler.BoundIdentifiers

        }

        return context.getDialect().analyzeExpression( context,
                                                        predicateDescr,
                                                        predicateDescr.getContent(),
                                                        new BoundIdentifiers( declarations,
                                                                              globals,
                                                                              operators,
                                                                              thisClass ) );
    }
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.