Package org.drools.compiler

Examples of org.drools.compiler.Primitives


        ksession.setGlobal( "iGlobal",
                            10 );
        ksession.setGlobal( "iArrayGlobal",
                            new int[]{ 40, 50, 60} );
       
        final Primitives p1 = new Primitives();
        p1.setPrimitiveIntArray( new int[]{ 40, 50, 60} );
        p1.setIntPrimitive( 5 );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setPrimitiveIntArray( new int[]{ 40, 50, 60} );
        p2.setIntPrimitive( 10 );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here


        ksession.setGlobal( "lGlobal",
                            10l );
        ksession.setGlobal( "lArrayGlobal",
                            new long[]{ 5, 10, 20}  );
       
        final Primitives p1 = new Primitives();
        p1.setPrimitiveLongArray( new long[]{ 5, 10, 20} );
        p1.setLongPrimitive( 5 );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setLongPrimitive( 10 );
        p2.setPrimitiveLongArray( new long[]{ 5, 10, 20} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

        ksession.setGlobal( "lGlobal",
                            10l );
        ksession.setGlobal( "lArrayGlobal",
                            new long[]{ 40, 50, 60}  );
       
        final Primitives p1 = new Primitives();
        p1.setPrimitiveLongArray( new long[]{ 40, 50, 60} );
        p1.setLongPrimitive( 5 );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setLongPrimitive( 10 );
        p2.setPrimitiveLongArray( new long[]{ 40, 50, 60} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

        ksession.setGlobal( "fGlobal",
                            10.0f );
        ksession.setGlobal( "fArrayGlobal",
                            new float[]{ 5, 10, 20} );
       
        final Primitives p1 = new Primitives();
        p1.setFloatPrimitive( 5 );
        p1.setPrimitiveFloatArray( new float[]{ 5, 10, 20} );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setFloatPrimitive( 10 );
        p2.setPrimitiveFloatArray( new float[]{ 5, 10, 20} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

        ksession.setGlobal( "fGlobal",
                            10.0f );
        ksession.setGlobal( "fArrayGlobal",
                            new float[]{ 40, 50, 60} );
       
        final Primitives p1 = new Primitives();
        p1.setFloatPrimitive( 5 );
        p1.setPrimitiveFloatArray( new float[]{ 40, 50, 60} );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setFloatPrimitive( 10 );
        p2.setPrimitiveFloatArray( new float[]{ 40, 50, 60} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

                            10.0d );
       
        ksession.setGlobal( "dArrayGlobal",
                            new double[]{ 5, 10, 20} );
       
        final Primitives p1 = new Primitives();
        p1.setPrimitiveDoubleArray( new double[]{ 5, 10, 20} );
        p1.setDoublePrimitive( 5 );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setDoublePrimitive( 10 );
        p2.setPrimitiveDoubleArray( new double[]{ 5, 10, 20} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

                            10.0d );
       
        ksession.setGlobal( "dArrayGlobal",
                            new double[]{ 40, 50, 60} );
       
        final Primitives p1 = new Primitives();
        p1.setPrimitiveDoubleArray( new double[]{ 40, 50, 60} );
        p1.setDoublePrimitive( 5 );
        FactHandle p1h = ksession.insert( p1 );
       
        final Primitives p2 = new Primitives();
        p2.setDoublePrimitive( 10 );
        p2.setPrimitiveDoubleArray( new double[]{ 40, 50, 60} );
        ksession.insert( p2 );

        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

         final List list = new ArrayList();
         ksession.setGlobal( "results",
                             list );

         final Primitives fact = new Primitives();
         fact.setBooleanPrimitive( true );
         fact.setBooleanWrapper( new Boolean( true ) );
         fact.setObject( new Boolean( true ) );
         fact.setCharPrimitive( 'X' );
         final org.kie.api.runtime.rule.FactHandle handle = ksession.insert( fact );

         ksession.fireAllRules();

         int index = 0;
         assertEquals( list.toString(),
                       4,
                       list.size() );
         assertEquals( "boolean",
                       list.get( index++ ) );
         assertEquals( "boolean wrapper",
                       list.get( index++ ) );
         assertEquals( "boolean object",
                       list.get( index++ ) );
         assertEquals( "char",
                       list.get( index++ ) );

         fact.setBooleanPrimitive( false );
         fact.setBooleanWrapper( null );
         fact.setCharPrimitive( '\0' );
         fact.setObject( new Character( 'X' ) );
         ksession.update( handle,
                          fact );
         ksession.fireAllRules();
         assertEquals( 5,
                       list.size() );
         assertEquals( "char object",
                       list.get( index++ ) );

         fact.setObject( null );
         ksession.update( handle,
                          fact );
         ksession.fireAllRules();
         assertEquals( 6,
                       list.size() );
View Full Code Here

                      "end";

         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         Primitives p = new Primitives();
         p.setBooleanPrimitive( true );
         p.setBooleanWrapper( Boolean.FALSE );

         ksession.insert( p );

         int rules = ksession.fireAllRules();
         ksession.dispose();
View Full Code Here

                      "end\n";

         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         ksession.insert( new Primitives() );
         int rules = ksession.fireAllRules();
         assertEquals( 1,
                       rules );
     }
View Full Code Here

TOP

Related Classes of org.drools.compiler.Primitives

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.