Examples of AccumulateFunction


Examples of org.drools.runtime.rule.AccumulateFunction

                                                                           new String[]{Object.class.getName(), KnowledgeHelper.class.getName(), KnowledgeHelper.class.getName(), Rule.class.getName(), decl.getValueType().getClassType().getName()}, // input types
                                                                           4,
                                                                           false,
                                                                           false );

            AccumulateFunction accFunction = new SumAccumulateFunction();

            Accumulator accumulator = new MVELAccumulatorFunctionExecutor( compilationUnit,
                                                                           accFunction );
            ((MVELCompileable) accumulator).compile( data );
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

            return getDefaultDialect();
        } else if ( name.equals( DefaultPackageNameOption.PROPERTY_NAME ) ) {
            return getDefaultPackageName();
        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
            int index = AccumulateFunctionOption.PROPERTY_NAME.length();
            AccumulateFunction function = this.accumulateFunctions.get( name.substring( index ) );
            return function != null ? function.getClass().getName() : null;
        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
            String key = name.substring( name.lastIndexOf( '.' ) + 1 );
            EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition( key );
            return evalDef != null ? evalDef.getClass().getName() : null;
        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

                      config.getProperty( DefaultDialectOption.PROPERTY_NAME ) );
    }
   
    public void testAccumulateFunctionConfiguration() {
        // in this use case, the application already has the instance of the accumulate function
        AccumulateFunction function = new AverageAccumulateFunction();
       
        // creating the option and storing in a local var just to make test easier
        AccumulateFunctionOption option = AccumulateFunctionOption.get( "avg", function );
       
        // wiring the accumulate function using the type safe method
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

            BoundIdentifiers boundIds = new BoundIdentifiers( declarationClasses, context.getPackageBuilder().getGlobals() ) ;         
           
            if ( accumDescr.isExternalFunction() ) {
                // build an external function executor
                AccumulateFunctionCallDescr func = accumDescr.getFunctions().get( 0 );
                AccumulateFunction function = context.getConfiguration().getAccumulateFunction( func.getFunction() );

                if( function == null ) {
                    context.getErrors().add( new DescrBuildError( accumDescr,
                                                                  context.getRuleDescr(),
                                                                  null,
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

        if ( accumDescr.isExternalFunction() ) {
            // if it is an external function, build a method for it
            // TODO: add the support to multiple functions
            AccumulateFunctionCallDescr func = accumDescr.getFunctions().get( 0 );
            AccumulateFunction function = context.getConfiguration().getAccumulateFunction( func.getFunction() );

            if ( function == null ) {
                context.getErrors().add( new DescrBuildError( accumDescr,
                                                              context.getRuleDescr(),
                                                              null,
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

            return getDefaultDialect();
        } else if ( name.equals( DefaultPackageNameOption.PROPERTY_NAME ) ) {
            return getDefaultPackageName();
        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
            int index = AccumulateFunctionOption.PROPERTY_NAME.length();
            AccumulateFunction function = this.accumulateFunctions.get( name.substring( index ) );
            return function != null ? function.getClass().getName() : null;
        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
            String key = name.substring( name.lastIndexOf( '.' ) + 1 );
            EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition( key );
            return evalDef != null ? evalDef.getClass().getName() : null;
        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

                                                                              "this" );

        int index = 0;
        for ( AccumulateFunctionCallDescr fc : funcCalls ) {
            // find the corresponding function
            AccumulateFunction function = context.getConfiguration().getAccumulateFunction( fc.getFunction() );
            if ( function == null ) {
                context.getErrors().add( new DescrBuildError( accumDescr,
                                                              context.getRuleDescr(),
                                                              null,
                                                              "Unknown accumulate function: '" + fc.getFunction() + "' on rule '" + context.getRuleDescr().getName() + "'. All accumulate functions must be registered before building a resource." ) );
View Full Code Here

Examples of org.drools.runtime.rule.AccumulateFunction

            return getDefaultDialect();
        } else if ( name.equals( DefaultPackageNameOption.PROPERTY_NAME ) ) {
            return getDefaultPackageName();
        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
            int index = AccumulateFunctionOption.PROPERTY_NAME.length();
            AccumulateFunction function = this.accumulateFunctions.get( name.substring( index ) );
            return function != null ? function.getClass().getName() : null;
        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
            String key = name.substring( name.lastIndexOf( '.' ) + 1 );
            EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition( key );
            return evalDef != null ? evalDef.getClass().getName() : null;
        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
View Full Code Here

Examples of org.kie.api.runtime.rule.AccumulateFunction

    }

    private void processAccumulateFunctions(PackageRegistry pkgRegistry,
                                            PackageDescr packageDescr) {
        for (final AccumulateImportDescr aid : packageDescr.getAccumulateImports() ) {
            AccumulateFunction af = loadAccumulateFunction(pkgRegistry,
                                                           aid.getFunctionName(),
                                                           aid.getTarget());
            pkgRegistry.getPackage().addAccumulateFunction(aid.getFunctionName(), af);
        }
    }
View Full Code Here

Examples of org.kie.api.runtime.rule.AccumulateFunction

            return getDefaultDialect();
        } else if ( name.equals( DefaultPackageNameOption.PROPERTY_NAME ) ) {
            return getDefaultPackageName();
        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
            int index = AccumulateFunctionOption.PROPERTY_NAME.length();
            AccumulateFunction function = this.accumulateFunctions.get( name.substring( index ) );
            return function != null ? function.getClass().getName() : null;
        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
            String key = name.substring( name.lastIndexOf( '.' ) + 1 );
            EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition( key );
            return evalDef != null ? evalDef.getClass().getName() : null;
        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
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.