Examples of Declaration


Examples of org.drools.rule.Declaration

    public void testCreateArgumentExplicitIdentifierDeclarationAlreadyDefined() throws Exception {
        final String explicitIdentifier = "explicit-identifier";
        FactArgumentMetadata metadata = new FactArgumentMetadata(explicitIdentifier, String.class);

        Declaration declaration = createDeclaration(explicitIdentifier);
        controlRule.expectAndReturn(mockRule.getParameterDeclaration(explicitIdentifier), declaration);

        mocks.replay();

        Argument argument = metadata.createArgument(mockRule);
View Full Code Here

Examples of org.drools.rule.Declaration

    public Class getParameterClass() {
        return parameterClass;
    }

    public Argument createArgument(Rule rule) throws DroolsException {
        Declaration declaration = rule.getParameterDeclaration(identifier);
        if (declaration == null) {
            BeanObjectType objectType = new BeanObjectType(parameterClass);
            declaration = rule.addParameterDeclaration(identifier, objectType);
        }
        return new FactArgument(declaration);
View Full Code Here

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

Examples of org.drools.rule.Declaration

        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

Examples of org.drools.rule.Declaration

            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

Examples of org.drools.rule.Declaration

    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

Examples of org.drools.rule.Declaration

{
    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

Examples of org.drools.rule.Declaration

    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

Examples of org.drools.rule.Declaration

    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

Examples of org.drools.rule.Declaration

    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
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.