Package org.drools.core.beliefsystem.defeasible

Examples of org.drools.core.beliefsystem.defeasible.DefeasibleBeliefSet


    private void checkStatus( EqualityKey key, int support, DefeasibilityStatus status ) {
        assertEquals( EqualityKey.JUSTIFIED, key.getStatus() );
        BeliefSet set = key.getBeliefSet();
        assertTrue( set instanceof DefeasibleBeliefSet );
        DefeasibleBeliefSet dfs = ( DefeasibleBeliefSet ) set;
//        LinkedListNode n = dfs.getFirst();
//        do {
//            System.out.println( n );
//            n = (LinkedListNode) n.getNext();
//        } while ( n != null );

        assertEquals( support, dfs.size() );
        assertEquals( status, dfs.getStatus() );
    }
View Full Code Here


        assertEquals( 1, posList.size() );
        assertEquals( 1, negList.size() );

        Object posBar = posList.get( 0 );
        InternalFactHandle posHandle = (InternalFactHandle) session.getFactHandle( posBar );
        DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) posHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isNegated() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isPositive() );
        assertSame( posHandle, dbs.getPositiveFactHandle() );
        assertNull( dbs.getNegativeFactHandle() );
        assertTruedbs.isDefeasiblyPosProveable() );
        assertTrue( session.getObjects().contains( posBar ) );

        Object negBar = negList.get( 0 );
        InternalFactHandle negHandle = (InternalFactHandle) session.getEntryPoint( "neg" ).getFactHandle( negBar );
        dbs = (DefeasibleBeliefSet) negHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isPositive() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isNegated() );
        assertSame( negHandle, dbs.getNegativeFactHandle() );
        assertNull( dbs.getPositiveFactHandle() );
        assertTruedbs.isDefeasiblyNegProveable() );
        assertFalse( session.getObjects().contains( negBar ) );

    }
View Full Code Here

        FactType factType = session.getKieBase().getFactType( "org.drools.defeasible", "Fact" );
        for ( Object o : session.getObjects( new ClassObjectFilter( factType.getFactClass() ) ) ) {
            if ( "wibble".equals( factType.get( o, "fact" ) ) ) {
                InternalFactHandle handle = (InternalFactHandle) session.getFactHandle( o );
                DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) handle.getEqualityKey().getBeliefSet();

                assertEquals( 3, dbs.size() );
                assertTrue( dbs.isConflicting() );
            }
        }

    }
View Full Code Here

    private void checkStatus( EqualityKey key, int support, DefeasibilityStatus status ) {
        assertEquals( EqualityKey.JUSTIFIED, key.getStatus() );
        BeliefSet set = key.getBeliefSet();
        assertTrue( set instanceof DefeasibleBeliefSet );
        DefeasibleBeliefSet dfs = ( DefeasibleBeliefSet ) set;
//        LinkedListNode n = dfs.getFirst();
//        do {
//            System.out.println( n );
//            n = (LinkedListNode) n.getNext();
//        } while ( n != null );

        assertEquals( support, dfs.size() );
        assertEquals( status, dfs.getStatus() );
    }
View Full Code Here

        assertEquals( 1, posList.size() );
        assertEquals( 1, negList.size() );

        Object posBar = posList.get( 0 );
        InternalFactHandle posHandle = (InternalFactHandle) session.getFactHandle( posBar );
        DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) posHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isNegated() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isPositive() );
        assertSame( posHandle, dbs.getPositiveFactHandle() );
        assertNull( dbs.getNegativeFactHandle() );
        assertTruedbs.isDefeasiblyPosProveable() );
        assertTrue( session.getObjects().contains( posBar ) );

        Object negBar = negList.get( 0 );
        InternalFactHandle negHandle = (InternalFactHandle) session.getEntryPoint( "neg" ).getFactHandle( negBar );
        dbs = (DefeasibleBeliefSet) negHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isPositive() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isNegated() );
        assertSame( negHandle, dbs.getNegativeFactHandle() );
        assertNull( dbs.getPositiveFactHandle() );
        assertTruedbs.isDefeasiblyNegProveable() );
        assertFalse( session.getObjects().contains( negBar ) );

    }
View Full Code Here

    private void checkStatus( EqualityKey key, int support, DefeasibilityStatus status ) {
        assertEquals( EqualityKey.JUSTIFIED, key.getStatus() );
        BeliefSet set = key.getBeliefSet();
        assertTrue( set instanceof DefeasibleBeliefSet );
        DefeasibleBeliefSet dfs = ( DefeasibleBeliefSet ) set;
//        LinkedListNode n = dfs.getFirst();
//        do {
//            System.out.println( n );
//            n = (LinkedListNode) n.getNext();
//        } while ( n != null );

        assertEquals( support, dfs.size() );
        assertEquals( status, dfs.getStatus() );
    }
View Full Code Here

    private void checkStatus( EqualityKey key, int support, DefeasibilityStatus status ) {
        assertEquals( EqualityKey.JUSTIFIED, key.getStatus() );
        BeliefSet set = key.getBeliefSet();
        assertTrue( set instanceof DefeasibleBeliefSet );
        DefeasibleBeliefSet dfs = ( DefeasibleBeliefSet ) set;
//        LinkedListNode n = dfs.getFirst();
//        do {
//            System.out.println( n );
//            n = (LinkedListNode) n.getNext();
//        } while ( n != null );

        assertEquals( support, dfs.size() );
        assertEquals( status, dfs.getStatus() );
    }
View Full Code Here

        assertEquals( 1, posList.size() );
        assertEquals( 1, negList.size() );

        Object posBar = posList.get( 0 );
        InternalFactHandle posHandle = (InternalFactHandle) session.getFactHandle( posBar );
        DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) posHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isNegated() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isPositive() );
        assertSame( posHandle, dbs.getPositiveFactHandle() );
        assertNull( dbs.getNegativeFactHandle() );
        assertTruedbs.isDefeasiblyPosProveable() );
        assertTrue( session.getObjects().contains( posBar ) );

        Object negBar = negList.get( 0 );
        InternalFactHandle negHandle = (InternalFactHandle) session.getEntryPoint( "neg" ).getFactHandle( negBar );
        dbs = (DefeasibleBeliefSet) negHandle.getEqualityKey().getBeliefSet();
        assertEquals( 1, dbs.size() );
        assertFalse( dbs.isPositive() );
        assertFalse( dbs.isUndecided() );
        assertTrue( dbs.isNegated() );
        assertSame( negHandle, dbs.getNegativeFactHandle() );
        assertNull( dbs.getPositiveFactHandle() );
        assertTruedbs.isDefeasiblyNegProveable() );
        assertFalse( session.getObjects().contains( negBar ) );

    }
View Full Code Here

        FactType factType = session.getKieBase().getFactType( "org.drools.defeasible", "Fact" );
        for ( Object o : session.getObjects( new ClassObjectFilter( factType.getFactClass() ) ) ) {
            if ( "wibble".equals( factType.get( o, "fact" ) ) ) {
                InternalFactHandle handle = (InternalFactHandle) session.getFactHandle( o );
                DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) handle.getEqualityKey().getBeliefSet();

                assertEquals( 3, dbs.size() );
                assertTrue( dbs.isConflicting() );
            }
        }

    }
View Full Code Here

    private void checkStatus( EqualityKey key, int support, DefeasibilityStatus status ) {
        assertEquals( EqualityKey.JUSTIFIED, key.getStatus() );
        BeliefSet set = key.getBeliefSet();
        assertTrue( set instanceof DefeasibleBeliefSet );
        DefeasibleBeliefSet dfs = ( DefeasibleBeliefSet ) set;
//        LinkedListNode n = dfs.getFirst();
//        do {
//            System.out.println( n );
//            n = (LinkedListNode) n.getNext();
//        } while ( n != null );

        assertEquals( support, dfs.size() );
        assertEquals( status, dfs.getStatus() );
    }
View Full Code Here

TOP

Related Classes of org.drools.core.beliefsystem.defeasible.DefeasibleBeliefSet

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.