Package org.drools.workbench.models.guided.dtree.shared.model.values.impl

Examples of org.drools.workbench.models.guided.dtree.shared.model.values.impl.BigDecimalValue


                String _value = value;
                if ( _value.endsWith( "B" ) ) {
                    _value = _value.substring( 0,
                                               _value.length() - 1 );
                }
                return new BigDecimalValue( new BigDecimal( _value ) );

            } catch ( NumberFormatException e ) {
                messages.add( new DataTypeConversionErrorParserMessage( value,
                                                                        BigDecimal.class.getName() ) );
                return null;
            }

        } else if ( DataType.TYPE_NUMERIC_BIGDECIMAL.equals( dataType ) ) {
            try {
                String _value = value;
                if ( _value.endsWith( "B" ) ) {
                    _value = _value.substring( 0,
                                               _value.length() - 1 );
                }
                return new BigDecimalValue( new BigDecimal( _value ) );

            } catch ( NumberFormatException e ) {
                messages.add( new DataTypeConversionErrorParserMessage( value,
                                                                        BigDecimal.class.getName() ) );
                return null;
View Full Code Here


public class GuidedDecisionTreeValuesTest {

    @Test
    public void testBigDecimalValue() {
        final BigDecimal tv = new BigDecimal( "1000000.12345" );
        final BigDecimalValue v = new BigDecimalValue( tv );
        assertEquals( tv,
                      v.getValue() );

        v.setValue( "1000000.12345" );
        assertEquals( tv,
                      v.getValue() );

        v.setValue( "abc" );
        assertEquals( new BigDecimal( "0" ),
                      v.getValue() );
    }
View Full Code Here

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "bigDecimalField",
                                                          "==",
                                                          new BigDecimalValue( new BigDecimal( 1000000 ) ) );
        model.setRoot( type );
        type.addChild( c1 );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "bigDecimalField",
                                                          "==",
                                                          new BigDecimalValue( new BigDecimal( 1000000 ) ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
View Full Code Here

        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "bigDecimalField",
                                                          "==",
                                                          new BigDecimalValue( new BigDecimal( 1000000 ) ) );
        model.setRoot( type );
        type.getChildren().add( c1 );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtree.shared.model.values.impl.BigDecimalValue

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.