Examples of FactHandle


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

Examples of org.drools.FactHandle

        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

Examples of org.drools.FactHandle

        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

Examples of org.drools.FactHandle

                          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

Examples of org.drools.FactHandle

        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

Examples of org.drools.FactHandle

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

Examples of org.drools.core.FactHandle

   
    public void propertyChange(final PropertyChangeEvent event) {
        final Object object = event.getSource();

        try {
            FactHandle handle = getFactHandle( object );
            if ( handle == null ) {
                throw new FactException( "Update error: handle not found for object: " + object + ". Is it in the working memory?" );
            }
            update( handle,
                    object );
View Full Code Here

Examples of org.drools.core.marshalling.impl.ProtobufMessages.FactHandle

            final org.drools.core.util.Iterator tupleIter = accmem.betaMemory.getLeftTupleMemory().iterator();
            for ( LeftTuple leftTuple = (LeftTuple) tupleIter.next(); leftTuple != null; leftTuple = (LeftTuple) tupleIter.next() ) {
                AccumulateContext accctx = (AccumulateContext) leftTuple.getObject();
                if ( accctx.getResultFactHandle() != null ) {
                    FactHandle _handle = ProtobufMessages.FactHandle.newBuilder()
                            .setId( accctx.getResultFactHandle().getId() )
                            .setRecency( accctx.getResultFactHandle().getRecency() )
                            .build();
                    _accumulate.addContext(
                            ProtobufMessages.NodeMemory.AccumulateNodeMemory.AccumulateContext.newBuilder()
View Full Code Here

Examples of org.drools.marshalling.impl.ProtobufMessages.FactHandle

           
            final org.drools.core.util.Iterator tupleIter = accmem.betaMemory.getLeftTupleMemory().iterator();
            for ( LeftTuple leftTuple = (LeftTuple) tupleIter.next(); leftTuple != null; leftTuple = (LeftTuple) tupleIter.next() ) {
                AccumulateContext accctx = (AccumulateContext) leftTuple.getObject();
                if( accctx.result != null ) {
                    FactHandle _handle = ProtobufMessages.FactHandle.newBuilder()
                            .setId( accctx.result.getFactHandle().getId() )
                            .setRecency( accctx.result.getFactHandle().getRecency() )
                            .build();
                    _accumulate.addContext(
                            ProtobufMessages.NodeMemory.AccumulateNodeMemory.AccumulateContext.newBuilder()
View Full Code Here

Examples of org.drools.runtime.rule.FactHandle

            while (iter.hasNext()) {
                Role r = (Role) iter.next();

                if (!identity.hasRole(r.getRoleType().getName(),
                        r.getGroup().getName(), r.getGroup().getGroupType())) {
                    FactHandle fh = getSecurityContext().getFactHandle(r);
                    getSecurityContext().retract(fh);
                }
            }
        }
    }
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.