Package org.drools.base.extractors

Examples of org.drools.base.extractors.SelfReferenceClassFieldReader


        // set of required previous declarations
        Set<Declaration> requiredDecl = new HashSet<Declaration>();

        // creating the custom array reader
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );

        int index = 0;
        for ( AccumulateFunctionCallDescr fc : funcCalls ) {
            // find the corresponding function
View Full Code Here


            arguments.add( null );
        }
        List<Declaration> requiredDeclarations = new ArrayList<Declaration>();      

        ObjectType argsObjectType = new ClassObjectType( Object[].class );
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader(Object[].class, "this");
        Pattern pattern = new Pattern( context.getNextPatternId(),
                                       0,
                                       argsObjectType,
                                       null );
View Full Code Here

            arguments.add( null );
        }
        List<Declaration> requiredDeclarations = new ArrayList<Declaration>();

        ObjectType argsObjectType = ClassObjectType.ObjectArray_ObjectType;
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );
        Pattern pattern = new Pattern( context.getNextPatternId(),
                                       0,
                                       argsObjectType,
                                       null );
View Full Code Here

        Accumulator[] accumulators;
        List<AccumulateFunctionCallDescr> functions = accumDescr.getFunctions();

        accumulators = new Accumulator[functions.size()];
        // creating the custom array reader
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );

        int index = 0;
        for ( AccumulateFunctionCallDescr func : functions ) {
            // build an external function executor
View Full Code Here

        // set of required previous declarations
        Set<Declaration> requiredDecl = new HashSet<Declaration>();

        // creating the custom array reader
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );

        int index = 0;
        for ( AccumulateFunctionCallDescr fc : funcCalls ) {
            // find the corresponding function
View Full Code Here

                if( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) {
                    // if the resolved still points to DroolsQuery, we know this is the first unification pattern, so redeclare it as the visible Declaration
                    declr = pattern.addDeclaration( declr.getIdentifier() );

                    // this bit is different, notice its the ArrayElementReader that we wire up to, not the declaration.
                    ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class, "this"),
                                                                        qe.getDeclIndexes()[i],
                                                                        resolved.getExtractor().getExtractToClass() );                   

                    declr.setReadAccessor( reader )
                   
View Full Code Here

        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );
        b.addConstraint( new VariableConstraint(
                         new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                         new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                AfterEvaluatorDefinition.AFTER,
                                                                                                "-2,2" ) ) ) );
        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "-3,4" ) ) ) );
        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, b.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,2" ) ) ) );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, c.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "2,3" ) ) ) );
        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, d.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,10" ) ) ) );

        GroupElement not = new GroupElement( Type.NOT );
View Full Code Here

                if( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) {
                    // if the resolved still points to DroolsQuery, we know this is the first unification pattern, so redeclare it as the visible Declaration
                    declr = pattern.addDeclaration( declr.getIdentifier() );

                    // this bit is different, notice its the ArrayElementReader that we wire up to, not the declaration.
                    ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class, "this"),
                                                                        qe.getDeclIndexes()[i],
                                                                        resolved.getExtractor().getExtractToClass() );                   

                    declr.setReadAccessor( reader )
                   
View Full Code Here

            arguments.add( null );
        }
        List<Declaration> requiredDeclarations = new ArrayList<Declaration>();

        ObjectType argsObjectType = ClassObjectType.ObjectArray_ObjectType;
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );
        Pattern pattern = new Pattern( context.getNextPatternId(),
                                       0,
                                       argsObjectType,
                                       null );
View Full Code Here

            arguments.add( null );
        }
        List<Declaration> requiredDeclarations = new ArrayList<Declaration>();

        ObjectType argsObjectType = ClassObjectType.ObjectArray_ObjectType;
        InternalReadAccessor arrayReader = new SelfReferenceClassFieldReader( Object[].class,
                                                                              "this" );
        Pattern pattern = new Pattern( context.getNextPatternId(),
                                       0,
                                       argsObjectType,
                                       null );
View Full Code Here

TOP

Related Classes of org.drools.base.extractors.SelfReferenceClassFieldReader

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.