Package java.math

Examples of java.math.BigDecimal$LongOverflow


        helpTestTransform(new BigInteger("0"), Boolean.FALSE); //$NON-NLS-1$
        helpTestTransform(new BigInteger("12"), Boolean.TRUE); //$NON-NLS-1$
    }
   
    @Test public void testBigDecimal2Boolean() throws TransformationException {
        helpTestTransform(new BigDecimal("1"), Boolean.TRUE); //$NON-NLS-1$
        helpTestTransform(new BigDecimal("0"), Boolean.FALSE); //$NON-NLS-1$
        helpTestTransform(new BigDecimal("0.00"), Boolean.FALSE); //$NON-NLS-1$
    }
View Full Code Here


    @Test public void testStringToLongWithWS() throws Exception {
      helpTestTransform(" 1 ", Long.valueOf(1)); //$NON-NLS-1$
    }
   
    @Test public void testEngineeringNotationFloatToBigInteger() throws Exception {
      helpTestTransform(Float.MIN_VALUE, new BigDecimal(Float.MIN_VALUE).toBigInteger());
    }
View Full Code Here

        // Set grouping elements to null
        node.setGroupingElements(null);        
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] data = new List[] {
            Arrays.asList(new Object[] { new BigDecimal("0.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("1.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("2.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("3.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("4.0") }) //$NON-NLS-1$
        };
       
        List[] expected = new List[] {
            Arrays.asList(new Object[] { new BigDecimal("10.0"), new BigDecimal("2.000000000") }) //$NON-NLS-1$ //$NON-NLS-2$
        };
               
        List symbols = new ArrayList();
        symbols.add(bigDecimal);
        FakeTupleSource dataSource = new FakeTupleSource(symbols, data);           
View Full Code Here

        groupingElements.add(col1);
        node.setGroupingElements(groupingElements);        
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] data = new List[] {
            Arrays.asList(new Object[] { new Integer(1), new BigDecimal("0.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(1), new BigDecimal("1.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(2), new BigDecimal("2.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(2), new BigDecimal("3.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(2), new BigDecimal("4.0") }) //$NON-NLS-1$
        };
       
        List[] expected = new List[] {
            Arrays.asList(new Object[] { new Integer(1), new BigDecimal("1.0"), new BigDecimal("0.500000000") }), //$NON-NLS-1$ //$NON-NLS-2$
            Arrays.asList(new Object[] { new Integer(2), new BigDecimal("9.0"), new BigDecimal("3.000000000") }) //$NON-NLS-1$ //$NON-NLS-2$
        };
               
        List symbols = new ArrayList();
        symbols.add(col1);
        symbols.add(bigDecimal);
View Full Code Here

    public void testMostTypes() throws Exception {
        Object[][] results = new Object[][] {
            new Object[] { new Integer(0), "ABCDEFGHIJ", new Float(0), new Long(0), new Double(0), new Byte((byte)0), //$NON-NLS-1$
                LoopbackExecution.SQL_DATE_VAL, LoopbackExecution.TIME_VAL,
                LoopbackExecution.TIMESTAMP_VAL, Boolean.FALSE,
                new BigInteger("0"), new BigDecimal("0"), "ABCDEFGHIJ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                new Short((short)0), new Character('c')
                 } 
        };
       
        helpTestQuery("SELECT intkey, StringKey, floatnum, longnum, doublenum, bytenum, " + //$NON-NLS-1$
View Full Code Here

                    break;

                case Types.DECIMAL:
                case Types.NUMERIC:

                    BigDecimal num = rs.getBigDecimal(columnNumber);
                    if (num == null) {
                        break;
                    }
                    if (num.scale() > 0) {
                        newprop.setFloatValue(num.doubleValue());
                    } else {
                        newprop.setIntegerValue(num.longValue());
                    }

                    break;

                case Types.VARBINARY:
View Full Code Here

    this.chararray_field = (boolean_field ? new char[] {char_field} : null);
    this.bytearray_field = (boolean_field ? new byte[] {byte_field} : null);
    this.doublearray_field = (boolean_field ? new double[] {double_field} : null);
    this.string_field = (boolean_field ? "str" + longval : null);
    biginteger_field = (boolean_field ? new BigInteger("" + longval) : null);
    bigdecimal_field = (boolean_field ? new BigDecimal(biginteger_field) : null);
  }
View Full Code Here

      Assert.assertEquals("bytearray_field bad value", 1, bytearray_field.length);
      Assert.assertEquals("bytearray_field bad value", byte_field, bytearray_field[0]);
      Assert.assertEquals("doubleArray_field bad value", 1, doublearray_field.length);
      Assert.assertEquals("string_field bad value", "str" + longval, string_field);
      Assert.assertEquals("biginteger_field bad value", new BigInteger("" + longval), biginteger_field);
      BigDecimal expected = new BigDecimal(biginteger_field);
      BigDecimal found = bigdecimal_field;
      Assert.assertTrue("bigdecimal_field bad value, expected " + expected
        + ", found: " + found,
        expected.compareTo(found)==0);
    }
  }
View Full Code Here

    this.chararray_field = (boolean_field ? new char[] {char_field} : null);
    this.bytearray_field = (boolean_field ? new byte[] {byte_field} : null);
    this.doubleArray_field = (boolean_field ? new double[] {double_field} : null);
    this.string_field = (boolean_field ? "str" + longval : null);
    biginteger_field = (boolean_field ? new BigInteger("" + longval) : null);
    bigdecimal_field = (boolean_field ? new BigDecimal(biginteger_field) : null);
  }
View Full Code Here

      Assert.assertEquals("bytearray_field bad value", 1, bytearray_field.length);
      Assert.assertEquals("bytearray_field bad value", byte_field, bytearray_field[0]);
      Assert.assertEquals("doubleArray_field bad value", 1, doubleArray_field.length);
      Assert.assertEquals("string_field bad value", "str" + longval, string_field);
      Assert.assertEquals("biginteger_field bad value", new BigInteger("" + longval), biginteger_field);
      BigDecimal expected = new BigDecimal(biginteger_field);
      BigDecimal found = bigdecimal_field;
      Assert.assertTrue("bigdecimal_field bad value, expected " + expected
        + ", found: " + found,
        expected.compareTo(found)==0);
    }
  }
View Full Code Here

TOP

Related Classes of java.math.BigDecimal$LongOverflow

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.