Examples of ExpressionMethod


Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionMethod

    public void testCopy() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fp = new FactPattern(SuggestionCompletionEngine.TYPE_OBJECT);
    fp.boundName = "$o";
    efl.appendPart(new ExpressionVariable(fp));
    ExpressionMethod em = new ExpressionMethod("aMethod", "aClass", "aType");
   
    ExpressionFormLine param = new ExpressionFormLine();
    param.appendPart(new ExpressionText("\"hello world\""));
    em.putParam("hi", param);
   
    efl.appendPart(em);
   
   
    ExpressionCollectionIndex index = new ExpressionCollectionIndex("get", "aRetType", "aGeneric");
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionMethod

  public void toStringText() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fact = new FactPattern("String");
    fact.boundName = "$v";
    efl.appendPart(new ExpressionVariable(fact));
    efl.appendPart(new ExpressionMethod("size", "int", SuggestionCompletionEngine.TYPE_NUMERIC));
      assertEquals("$v.size()", efl.getText());
   
    efl.setBinding("$s");
   
      assertEquals("$s: $v.size()", efl.getText(true));
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionMethod

        return lb;
    }

    private void onCollectionChange(String value) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         SuggestionCompletionEngine.TYPE_NUMERIC ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         SuggestionCompletionEngine.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getCompletionEngine().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 SuggestionCompletionEngine.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        SuggestionCompletionEngine.TYPE_NUMERIC ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionMethod

            expression.removeLast();
        } else if ( SuggestionCompletionEngine.TYPE_COLLECTION.equals( getCurrentGenericType() ) ) {
            onCollectionChange( value );
        } else if ( SuggestionCompletionEngine.TYPE_STRING.equals( getCurrentGenericType() ) ) {
            if ( "size".equals( value ) ) {
                expression.appendPart( new ExpressionMethod( "size",
                                                             "int",
                                                             SuggestionCompletionEngine.TYPE_NUMERIC ) );
            } else if ( "isEmpty".equals( value ) ) {
                expression.appendPart( new ExpressionText( ".size() == 0",
                                                           "",
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionMethod

  public void testCopy() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fp = new FactPattern(SuggestionCompletionEngine.TYPE_OBJECT);
    fp.boundName = "$o";
    efl.appendPart(new ExpressionVariable(fp));
    ExpressionMethod em = new ExpressionMethod("aMethod", "aClass", "aType");
   
    ExpressionFormLine param = new ExpressionFormLine();
    param.appendPart(new ExpressionText("\"hello world\""));
    em.putParam("hi", param);
   
    efl.appendPart(em);
   
   
    ExpressionCollectionIndex index = new ExpressionCollectionIndex("get", "aRetType", "aGeneric");
View Full Code Here

Examples of org.drools.workbench.models.commons.shared.rule.ExpressionMethod

        return lb;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getCompletionEngine().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

Examples of org.drools.workbench.models.commons.shared.rule.ExpressionMethod

            expression.removeLast();
        } else if ( DataType.TYPE_COLLECTION.equals( getCurrentGenericType() ) ) {
            onCollectionChange( value );
        } else if ( DataType.TYPE_STRING.equals( getCurrentGenericType() ) ) {
            if ( "size".equals( value ) ) {
                expression.appendPart( new ExpressionMethod( "size",
                                                             "int",
                                                             DataType.TYPE_NUMERIC_INTEGER ) );
            } else if ( "isEmpty".equals( value ) ) {
                expression.appendPart( new ExpressionText( ".size() == 0",
                                                           "",
View Full Code Here

Examples of org.drools.workbench.models.commons.shared.rule.ExpressionMethod

        MethodInfo mi = sce.getMethodInfo( factName, methodName );
        if ( DataType.TYPE_COLLECTION.equals( mi.getGenericType() ) ) {
            return new ExpressionCollection( methodName, mi.getReturnClassType(),
                                             mi.getGenericType(), mi.getParametricReturnType() );
        }
        return new ExpressionMethod( mi.getName(), mi.getReturnClassType(), mi.getGenericType() );
    }
View Full Code Here

Examples of org.drools.workbench.models.commons.shared.rule.ExpressionMethod

        MethodInfo mi = sce.getMethodInfo( factName, methodName );
        if ( DataType.TYPE_COLLECTION.equals( mi.getGenericType() ) ) {
            return new ExpressionCollection( methodName, mi.getReturnClassType(),
                                             mi.getGenericType(), mi.getParametricReturnType() );
        }
        return new ExpressionMethod( mi.getName(), mi.getReturnClassType(), mi.getGenericType() );
    }
View Full Code Here

Examples of org.drools.workbench.models.commons.shared.rule.ExpressionMethod

        return lb;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getCompletionEngine().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
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.