Package org.drools.rule

Examples of org.drools.rule.Declaration


        List list = new ArrayList();

        ObjectType objectType;
        Class clazz;
        String identifier;
        Declaration declaration;

        String type;
        int nestedClassPosition;

        for ( int i = 0; i < declarations.length; i++ )
        {
            declaration = declarations[i];
            identifier = declaration.getIdentifier();
            objectType = declaration.getObjectType();

            clazz = ((ClassObjectType) objectType).getType();

            type = clazz.getName();
            nestedClassPosition = type.indexOf( '$' );
View Full Code Here


        ClassObjectType ObjectType = new ClassObjectType( Object.class );

        /*
         * Build the declaration and specify it as a parameter of the hello Rule
         */
        final Declaration helloDeclaration = helloRule.addParameterDeclaration( "hello",
                                                                                StringType );

        /*
         * Build the declaration and specify it as a parameter of the goodbye
         * Rule
         */
        final Declaration goodbyeDeclaration = goodbyeRule.addParameterDeclaration( "goodbye",
                                                                                    StringType );

        /*
         * Build the declaration and specify it as a parameter of the debug Rule
         */
        final Declaration debugDeclaration = debugRule.addParameterDeclaration( "object",
                                                                                ObjectType );

        /*
         * Build and Add the Condition to the hello Rule
         */
 
View Full Code Here

            buffer.append( "applicationData.get(\"" );
            buffer.append( identifier );
            buffer.append( "\");\n" );
        }

        Declaration declaration = null;
        for ( int i = 0; i < declarations.length; i++ )
        {
            declaration = declarations[i];
            identifier = declaration.getIdentifier();
            clazz = declaration.getClass();
            buffer.append( clazz.getName() );
            buffer.append( " " );
            buffer.append( identifier );
            buffer.append( " " );
            buffer.append( "tuple.get(\"" );
View Full Code Here

    List createParameterNodes(Rule rule)
    {
        List leafNodes = new LinkedList( );
        Iterator declIter = rule.getParameterDeclarations( ).iterator( );

        Declaration eachDecl;
        while ( declIter.hasNext( ) )
        {
            eachDecl = (Declaration) declIter.next( );

            attachNode( new ParameterNode( this.rete.getOrCreateObjectTypeNode( eachDecl.getObjectType( ) ),
                                           eachDecl ),
                        leafNodes );
        }

        return leafNodes;
View Full Code Here

{
    public void testAssertObject() throws Exception
    {
        Rule rule = new Rule( getName( ) );

        Declaration decl = rule.addParameterDeclaration( "object", new MockObjectType( Object.class ) );

        ObjectTypeNode objectTypeNode = new ObjectTypeNode( new MockObjectType( String.class ) );

        InstrumentedParameterNode paramNode = new InstrumentedParameterNode( null, decl );
        paramNode.addTupleSink( new InstrumentedTupleSink( ) );
View Full Code Here

    public void testPutGetMatch()
    {
        AgendaItemMap map = new AgendaItemMap( );
        ObjectType objType = getMockObjectType( );

        Declaration dec = new Declaration( "somthing",
                                           objType,
                                           1 );
        TupleKey key = new TupleKey( dec,
                                     new FactHandleImpl( 1 ) );
        Rule rule = new Rule( "name1" );
View Full Code Here

    public void testMoreComplex()
    {
        AgendaItemMap map = new AgendaItemMap( );
        ObjectType objType = getMockObjectType( );

        Declaration dec = new Declaration( "somthing",
                                           objType,
                                           1 );
        TupleKey key = new TupleKey( dec,
                                     new FactHandleImpl( 1 ) );
View Full Code Here

    public void testRemoveAll()
    {
        AgendaItemMap map = new AgendaItemMap( );
        ObjectType objType = getMockObjectType( );

        Declaration dec = new Declaration( "somthing",
                                           objType,
                                           1 );
        TupleKey key = new TupleKey( dec,
                                     new FactHandleImpl( 1 ) );
        map.put( new Rule( "name1" ),
View Full Code Here

    {
        AgendaItemMap map = new AgendaItemMap( );
        assertTrue( map.isEmpty( ) );
        ObjectType objType = getMockObjectType( );

        Declaration dec = new Declaration( "somthing",
                                           objType,
                                           1 );
        TupleKey key = new TupleKey( dec,
                                     new FactHandleImpl( 1 ) );
        map.put( new Rule( "name1" ),
View Full Code Here

    public void testConstruct() throws Exception
    {
        FactHandleImpl handle = new FactHandleImpl( 1 );

        Rule rule = new Rule( "test-rule" );
        Declaration decl = rule.addParameterDeclaration( "paramVar", new MockObjectType( true ) );

        //add consequence
        rule.setConsequence( new org.drools.spi.InstrumentedConsequence( ) );
        //add condition
        rule.addCondition( new org.drools.spi.InstrumentedCondition( ) );
View Full Code Here

TOP

Related Classes of org.drools.rule.Declaration

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.