Package org.drools

Examples of org.drools.FactHandle


        assertTrue(Serializable.class.isAssignableFrom( FactHandleList.class ) );
    }

    public void testSingleValueConstruction()
    {
        FactHandle handle = new FactHandleImpl( 37 );
        FactHandleList list = new FactHandleList( 2, handle );
        assertEquals( 3, list.size( ) );
        assertNull( list.get( 0 ) );
        assertNull( list.get( 1 ) );
        assertSame( handle, list.get( 2 ) );
View Full Code Here


        assertSame( handle, list.get( 2 ) );
    }

    public void testJoinConstruction()
    {
        FactHandle handleA = new FactHandleImpl( 37 );
        FactHandle handleB = new FactHandleImpl( 43 );

        FactHandleList list = new FactHandleList( new FactHandleList( 1, handleA ),
                                                  new FactHandleList( 3, handleB ) );

        assertEquals( 4, list.size() );
View Full Code Here

        assertSame( handleB, list.get( 3 ) );
    }

    public void testContains()
    {
        FactHandle handle = new FactHandleImpl( 13 );
        FactHandleList list = new FactHandleList( 8, handle );
        assertTrue( list.contains( handle ) );
        assertFalse( list.contains( new FactHandleImpl( 203 ) ) );
    }
View Full Code Here

        assertFalse( list.contains( new FactHandleImpl( 203 ) ) );
    }

    public void testContainsAll()
    {
        FactHandle handleA = new FactHandleImpl( 37 );
        FactHandle handleB = new FactHandleImpl( 43 );
        FactHandle handleC = new FactHandleImpl( 59 );
        FactHandle handleD = new FactHandleImpl( 61 );

        FactHandleList listA = new FactHandleList( 1, handleA );
        FactHandleList listB = new FactHandleList( 3, handleB );
        FactHandleList listC = new FactHandleList( 0, handleC );
        FactHandleList listD = new FactHandleList( 2, handleD );
View Full Code Here

        assertFalse( listABCD.containsAll( new FactHandleList( 99, handleA ) ) );
    }

    public void testIndexOutOfBoundsThrowsException()
    {
        FactHandle handle = new FactHandleImpl( 253 );
        FactHandleList list = new FactHandleList( 0, handle );
        try
        {
            list.get( 1 );
            fail();
View Full Code Here

    {
        Object fact = new Object();

        WorkingMemory memory = new WorkingMemoryImpl( new RuleBaseImpl( new Rete( ) ) );

        FactHandle handleA = memory.assertObject( fact );

        assertNotNull( handleA );

        FactHandle handleB = memory.assertObject( fact );

        assertSame( handleA, handleB );

        List objects = memory.getObjects( );
View Full Code Here

        {
            public void invoke(org.drools.spi.Tuple tuple)
            {       
                //throw in a different tuple, to check the agenda doesn't stop the rule/tuple combo
                Declaration dec = new Declaration("paramVar", new MockObjectType(true), 1);
                FactHandle fact = new FactHandleImpl(42);
                ReteTuple different = new ReteTuple(workingMemory, dec, fact);
                agenda.addToAgenda( different,
                                    rule );
            }
        } );
View Full Code Here

    /**
     * @see WorkingMemory
     */
    public FactHandle getFactHandle(Object object) throws NoSuchFactHandleException
    {
        FactHandle factHandle = (FactHandle) this.identityMap.get( object );

        if ( factHandle == null )
        {
            throw new NoSuchFactHandleException( object );
        }
View Full Code Here

                            boolean logical,
                            Rule rule,
                            Activation activation) throws FactException
    {
        /* check if the object already exists in the WM */
        FactHandle handle = (FactHandle) this.identityMap.get( object );       

        /* only return if the handle exists and this is a logical assertion */
        if ( ( handle != null ) && ( logical ) )
        {
            return handle;
View Full Code Here

    /**
     * @see Tuple
     */
    public Object get(int col)
    {
        FactHandle handle = this.key.get( col );
        return get( handle );
    }
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.