Package org.drools

Examples of org.drools.FactHandle


                                                 context,
                                                 rule1 );
           
        /* Assert the logical "logical" fact */
        String logicalString1 = new String ( "logical" );
        FactHandle logicalHandle1 = workingMemory.assertObject( logicalString1,
                                                                false,
                                                                true,
                                                                rule1,
                                                                activation1 );
       
        /* create the second activation to justify the "logical" fact */
        final Rule rule2 = new Rule( "test-rule2" );
        rule2.setConsequence( consequence );         
       
        FactHandleImpl handle2 = new FactHandleImpl( 2 );
        ReteTuple tuple2 = new ReteTuple( 0,
                                          handle2,
                                          workingMemory );

        Activation activation2 = new AgendaItem( tuple2,
                                                 context,
                                                 rule2 );

       
        /* Assert the logical "logical" fact */
        String logicalString2 = new String ( "logical" );
        FactHandle logicalHandle2 = workingMemory.assertObject( logicalString2,
                                                                false,
                                                                true,
                                                                rule2,
                                                                activation2 );
       
View Full Code Here


        Activation[] activations = ( Activation[] ) main.getActivationQueue().toArray( new Activation[] {} );              
       
        /* Create the first justifieable relationship */
        String logicalString1 = new String ( "logical" );
        Activation activation1 = activations[0];
        FactHandle logicalHandle1 = workingMemory.assertObject( logicalString1,
                                                               false,
                                                               true,
                                                               activation1.getRule(),
                                                               activation1 );
       
        /* Create the second justifieable relationship */
        String logicalString2 = new String ( "logical" );
        Activation activation2 = activations[1];       
        FactHandle logicalHandle2 = workingMemory.assertObject( logicalString2,
                                                               false,
                                                               true,
                                                               activation2.getRule(),
                                                               activation2 );
       
View Full Code Here

        assertEquals( 0,
                      listener.asserted );
        assertEquals( 0,
                      listener.tested );
        FactHandle stringFact1 = workingMemory.assertObject( "cheddar" );
        FactHandle stringFact2 = workingMemory.assertObject( "brie" );
        FactHandle intFact = workingMemory.assertObject( new Integer( 5 ) );
        assertEquals( 3,
                      listener.asserted );
        assertEquals( 5,
                      listener.tested );
        assertEquals( 4,
View Full Code Here

                          this.handles,
                          0,
                          left.handles.length );

        int hashCode = left.hashCode;
        FactHandle handle;

        for ( int i = right.handles.length - 1; i >= 0; i-- )
        {
            handle = right.handles[i];
            if ( handle != null && this.handles[i] == null )
            {
                this.handles[i] = handle;
                hashCode += handle.hashCode( );
            }
        }

        this.hashCode = hashCode;
    }
View Full Code Here

        if ( other.handles.length > this.handles.length )
        {
            return false;
        }

        FactHandle handle;
        for ( int i = other.handles.length - 1; i >= 0; i-- )
        {
            handle = other.handles[i];
            if ( handle != null && !handle.equals( this.handles[i] ) )
            {
                return false;
            }
        }
        return true;
View Full Code Here

         while (iter.hasNext())
         {
            Role r = iter.next();
            if (!identity.hasRole(r.getName()))
            {
               FactHandle fh = getSecurityContext().getFactHandle(r);
               getSecurityContext().retract(fh);
            }
         }
      }
   }
View Full Code Here

        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
        for ( int i = 0; i < cheese.length; i++ ) {
            cheeseHandles[i] = wm.insert( cheese[i] );
        }
        final FactHandle bobHandle = wm.insert( bob );

        // ---------------- 1st scenario
        wm.fireAllRules();
        // no fire, as per rule constraints
        Assert.assertEquals( 0,
View Full Code Here

        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
        for ( int i = 0; i < cheese.length; i++ ) {
            cheeseHandles[i] = wm.insert( cheese[i] );
        }
        final FactHandle bobHandle = wm.insert( bob );

        // ---------------- 1st scenario
        wm.fireAllRules();
        // no fire, as per rule constraints
        Assert.assertEquals( 0,
View Full Code Here

        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
        for ( int i = 0; i < cheese.length; i++ ) {
            cheeseHandles[i] = wm.insert( cheese[i] );
        }
        final FactHandle bobHandle = wm.insert( bob );

        // ---------------- 1st scenario
        wm.fireAllRules();
        // no fire, as per rule constraints
        Assert.assertEquals( 0,
View Full Code Here

        final FactHandle[] cheeseHandles = new FactHandle[cheese.length];
        for ( int i = 0; i < cheese.length; i++ ) {
            cheeseHandles[i] = wm.insert( cheese[i] );
        }
        final FactHandle bobHandle = wm.insert( bob );

        // ---------------- 1st scenario
        wm.fireAllRules();
        // no fire, as per rule constraints
        Assert.assertEquals( 0,
View Full Code Here

TOP

Related Classes of org.drools.FactHandle

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.