Package org.drools.decisiontable.model

Examples of org.drools.decisiontable.model.Consequence


        Condition cond = new Condition( );
        cond.setSnippet( "System.currentTimeMillis() > 42 /* comment here */" );
        rule.addCondition( cond );

        Consequence cons = new Consequence( );
        cons.setSnippet( "System.out.println(\"yeah\");" );
        rule.addConsequence( cons );

        Parameter param = new Parameter( );
        param.setClassName( "java.lang.String" ); //$NON-NLS-1$
        param.setIdentifier( "s" );
View Full Code Here


                      param.getClassName( ) );
        Condition cond = (Condition) rule.getConditions( ).get( 0 );
        assertEquals( "myObject.getColour().equals(red)",
                      cond.getSnippet( ) );

        Consequence cons = (Consequence) rule.getConsequences( ).get( 0 );
        assertNotNull( cons );
        assertEquals( "myObject.setIsValid(Y)",
                      cons.getSnippet( ) );

        rule = (Rule) ruleset.getRules( ).get( 5 );
        cond = (Condition) rule.getConditions( ).get( 1 );
        assertEquals( "myObject.size () > 7",
                      cond.getSnippet( ) );
        cons = (Consequence) rule.getConsequences( ).get( 0 );
        assertEquals( "myObject.setIsValid(10-Jul-1974)",
                      cons.getSnippet( ) );

    }
View Full Code Here

        Rule rule = (Rule) ruleset.getRules( ).get( 0 );
        assertEquals( 3,
                      rule.getConditions( ).size( ) );
        assertEquals( 2,
                      rule.getConsequences( ).size( ) );
        Consequence cons = (Consequence) rule.getConsequences( ).get( 1 );
        assertEquals( "myObject.setIsValid(1, 2)",
                      cons.getSnippet( ) );
        Condition con = (Condition) rule.getConditions( ).get( 2 );
        assertEquals( "myObject.size() < 3",
                      con.getSnippet( ) );

        rule = (Rule) ruleset.getRules( ).get( 4 );
View Full Code Here

    private void createConsequence(int column,
                                   String value,
                                   ActionType actionType)
    {

        Consequence cons = new Consequence( );
        cons.setSnippet( actionType.getSnippet( value ) );
        cons.setComment( cellComment( column ) );
        _currentRule.addConsequence( cons );
    }
View Full Code Here

                if ( src instanceof LhsBuilder ) {
                    Condition con = new Condition();
                    con.setSnippet( src.getResult() );
                    _currentRule.addCondition( con );
                } else if ( src instanceof RhsBuilder ) {
                    Consequence con = new Consequence();
                    con.setSnippet( src.getResult() );
                    _currentRule.addConsequence( con );
                }
                src.clearValues();
            }
        }
View Full Code Here

    }

    private void createRule(final int row,
                                   final int column,
                                   final String value) {
        final Consequence consequence = createConsequence( value );

        Rule rule = firstRule;
        if ( rule == null ) {
            rule = new Rule( "rule_" + row + "_" + column,
                             null,
View Full Code Here

    }

    private Consequence createConsequence(final String value) {
        final SnippetBuilder snip = new SnippetBuilder( _action );
        final String result = snip.build( value );
        final Consequence consequence = new Consequence();
        consequence.setSnippet( result );
        return consequence;
    }
View Full Code Here

  private Consequence createConsequence(RuleTemplate template) {
    StringBuffer action = new StringBuffer();
    action.append("generator.generate( \"");
    action.append(template.getName()).append("\", r);");
    final Consequence consequence = new Consequence();
    consequence.setSnippet(action.toString());
    return consequence;
  }
View Full Code Here

  private Consequence createConsequence(RuleTemplate template) {
    StringBuffer action = new StringBuffer();
    action.append("generator.generate( \"");
    action.append(template.getName()).append("\", r);");
    final Consequence consequence = new Consequence();
    consequence.setSnippet(action.toString());
    return consequence;
  }
View Full Code Here

        Rule rule = (Rule) ruleset.getRules().get( 0 );
        Condition cond = (Condition) rule.getConditions().get( 0 );
        assertEquals( "Foo(myObject.getColour().equals(red), myObject.size () > 1)",
                      cond.getSnippet() );

        Consequence cons = (Consequence) rule.getConsequences().get( 0 );
        assertNotNull( cons );
        assertEquals( "myObject.setIsValid(Y);",
                      cons.getSnippet() );

        rule = (Rule) ruleset.getRules().get( 5 );
        cond = (Condition) rule.getConditions().get( 1 );
        assertEquals( "myObject.size () > 7",
                      cond.getSnippet() );
        cons = (Consequence) rule.getConsequences().get( 0 );
        assertEquals( "myObject.setIsValid(10-Jul-1974)",
                      cons.getSnippet() );

    }
View Full Code Here

TOP

Related Classes of org.drools.decisiontable.model.Consequence

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.