Examples of BigDecimalWrapperImpl


Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

        int inputPrecision = inputInstance.attribute(DecimalAttribute.PRECISION);
        int targetPrecision = targetInstance.attribute(DecimalAttribute.PRECISION);
        int inputScale = inputInstance.attribute(DecimalAttribute.SCALE);
        int targetScale = targetInstance.attribute(DecimalAttribute.SCALE);
        if ( (inputPrecision != targetPrecision) || (inputScale != targetScale) ) {
            BigDecimalWrapper bdw = new BigDecimalWrapperImpl().set(getWrapper(source, inputInstance));
            bdw.round(targetScale);
            target.putObject(bdw);
        }
        else if (source.hasCacheValue()) {
            target.putObject(source.getObject());
View Full Code Here

Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

        // If the incoming ValueSource is a DECIMAL, *and* it has a cache value (ie an BigDecimalWrapper), then
        // we can just copy the wrapper into the output. If the incoming is a DECIMAL with bytes (its raw form), we
        // can only copy those bytes if the TInstance match -- and super.tryFromObject already makes that check.
        if (in.getType().typeClass() instanceof TBigDecimal && in.hasCacheValue()) {
            BigDecimalWrapper cached = (BigDecimalWrapper) in.getObject();
            out.putObject(new BigDecimalWrapperImpl(cached.asBigDecimal()));
            return true;
        }
        return super.tryFromObject(context, in, out);
    }
View Full Code Here

Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

        if (meta == null)
        {
            // compute the max value:
            meta = new BigDecimalWrapper[2];
            meta[TBigDecimal.MAX_INDEX] = new BigDecimalWrapperImpl(getNum(expectedScale, expectedPre));
            meta[TBigDecimal.MIN_INDEX] = new BigDecimalWrapperImpl(meta[TBigDecimal.MAX_INDEX].asBigDecimal().negate());

            context.outputType().setMetaData(meta);
        }

        if (num.compareTo(meta[TBigDecimal.MAX_INDEX]) >= 0)
View Full Code Here

Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

        String truncated = st.substring(0, m.end());
       
        if (!truncated.equals(st))
            context.reportTruncate(st, truncated);
       
        BigDecimalWrapperImpl ret = BigDecimalWrapperImpl.ZERO;
        try
        {
            ret = new BigDecimalWrapperImpl(truncated);
        }
        catch (NumberFormatException e)
        {
            context.reportBadValue(e.getMessage());
        }
View Full Code Here

Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

                // BigDecimal interprets something like "0.01" as having a scale of 2 and precision of 1.
                precision = scale;
            }
            type = MNumeric.DECIMAL.instance(precision, scale, false);
            value = new Value(type);
            value.putObject(new BigDecimalWrapperImpl(bd));
        }
        else if (object instanceof ByteSource || object instanceof byte[]) {
            byte[] bytes;
            if (object instanceof byte[]) {
                bytes = (byte[])object;
View Full Code Here

Examples of com.foundationdb.server.types.common.BigDecimalWrapperImpl

        AkibanAppender appender = AkibanAppender.of(new StringBuilder(fieldDef().getMaxStorageSize()));
        ConversionHelperBigDecimal.decodeToString(fieldDef(), bytes(), getRawOffsetAndWidth(), appender);
        String asString = appender.toString();
        assert ! asString.isEmpty();
        try {
            return new BigDecimalWrapperImpl(new BigDecimal(asString));
        } catch (NumberFormatException e) {
            throw new NumberFormatException(asString);
        }
    }
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.