Package org.drools

Examples of org.drools.Person$Nested1


        session.fireAllRules();

        assertEquals( 1,
                      list.size() );

        Person p = new Person( "diablo",
                               new Cheese( "cheddar" ) );

        assertEquals( p,
                      list.get( 0 ) );
    }
View Full Code Here


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

        final PersonInterface bill = new Person( "bill",
                                                 null,
                                                 12 );
        bill.setBigDecimal( new BigDecimal( "42" ) );
        bill.setBigInteger( new BigInteger( "42" ) );

        workingMemory.insert( bill );
        workingMemory.fireAllRules();

        assertEquals( 6,
View Full Code Here

        assertEquals( 9,
                      cell.getValue() );
    }

    public void testNesting() throws Exception {
        Person p = new Person();
        p.setName( "Michael" );

        Address add1 = new Address();
        add1.setStreet( "High" );

        Address add2 = new Address();
        add2.setStreet( "Low" );

        List l = new ArrayList();
        l.add( add1 );
        l.add( add2 );

        p.setAddresses( l );

        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "nested_fields.drl" ) ) );

        assertFalse( builder.getErrors().toString(),
View Full Code Here

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

        final Person foo = new Person( "foo" );
        workingMemory.insert( foo );
        workingMemory.fireAllRules();

        assertEquals( foo,
                      list.get( 0 ) );
View Full Code Here

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

        final PersonInterface peter = new Person( "peter",
                                                  null,
                                                  12 );
        workingMemory.insert( peter );
        final PersonInterface jane = new Person( "jane",
                                                 null,
                                                 10 );
        workingMemory.insert( jane );

        workingMemory.fireAllRules();
View Full Code Here

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

        final PersonInterface peter = new Person( "peter",
                                                  null,
                                                  12 );
        workingMemory.insert( peter );
        final PersonInterface jane = new Person( "jane",
                                                 null,
                                                 10 );
        workingMemory.insert( jane );

        workingMemory.fireAllRules();
View Full Code Here

        final RuleBase ruleBase = getRuleBase();
        ruleBase.addPackage( pkg );
        final WorkingMemory workingMemory = ruleBase.newStatefulSession();

        final PersonInterface p1 = new Person( "michael",
                                               "food",
                                               40 );
        final PersonInterface p2 = new Person( null,
                                               "drink",
                                               30 );
        workingMemory.insert( p1 );
        workingMemory.insert( p2 );
View Full Code Here

        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
        final List foo = new ArrayList();
        workingMemory.setGlobal( "messages",
                                 foo );

        final PersonInterface p1 = new Person( null,
                                               "food",
                                               40 );
        final Primitives p2 = new Primitives();
        p2.setArrayAttribute( null );
View Full Code Here

        cheesery.addCheese( cheddar );
        workingMemory.setGlobal( "cheesery",
                                 cheesery );
        workingMemory.insert( cheesery );

        Person p = new Person( "stilton" );
        workingMemory.insert( p );

        workingMemory.fireAllRules();

        // from using a global
View Full Code Here

        workingMemory.setGlobal( "testObject",
                                 new FromTestClass() );
        workingMemory.setGlobal( "globalObject",
                                 globalObject );

        final Person bob = new Person( "bob" );
        workingMemory.insert( bob );

        workingMemory.fireAllRules();

        assertEquals( 6,
                      list.size() );

        final List array = (List) list.get( 0 );
        assertEquals( 3,
                      array.size() );
        final Person p = (Person) array.get( 0 );
        assertSame( p,
                    bob );

        assertEquals( new Integer( 42 ),
                      array.get( 1 ) );
View Full Code Here

TOP

Related Classes of org.drools.Person$Nested1

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.