public final class BigIntegerDecimal extends BinaryDecimal
| Modifier and Type | Field and Description |
|---|---|
private static java.math.BigInteger |
MAXLONG_PLUS_ONE |
private static java.math.BigInteger |
MINLONG_MINUS_ONE |
private static java.math.BigInteger |
TEN |
data2c, sqlScaleONE, ZERO, ZERO_DECIMALIGNORE_PRECISIONMAX_DECIMAL_PRECISION_SCALE, MIN_DECIMAL_DIVIDE_SCALEUNKNOWN_LOGICAL_LENGTHORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN| Constructor and Description |
|---|
BigIntegerDecimal() |
| Modifier and Type | Method and Description |
|---|---|
NumberDataValue |
divideNN(NumberDataValue left,
NumberDataValue right,
NumberDataValue result,
int scale)
Divide two non-null NumberDataValues using DECIMAL arithmetic.
|
private BigIntegerDecimal |
getBID(DataValueDescriptor value)
Obtain a BinaryDecimal that represents the passed in value.
|
boolean |
getBoolean()
Gets the value in the data value descriptor as a boolean.
|
int |
getDecimalValuePrecision()
Return the SQL precision of this value.
|
double |
getDouble()
Gets the value in the data value descriptor as a double.
|
float |
getFloat()
Gets the value in the data value descriptor as a float.
|
long |
getLong()
Gets the value in the data value descriptor as a long.
|
DataValueDescriptor |
getNewNull()
Get a new null value of the same type as this data value.
|
java.lang.Object |
getObject()
Gets the value in the data value descriptor as a int.
|
java.lang.String |
getString()
Gets the value in the data value descriptor as a String.
|
NumberDataValue |
minus(NumberDataValue result)
Negate the number.
|
void |
normalize(DataTypeDescriptor desiredType,
DataValueDescriptor source)
Default normalization method.
|
NumberDataValue |
plusNN(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
Add two non-null NumberDataValues using DECIMAL arithmetic.
|
private static java.math.BigInteger |
rescale(java.math.BigInteger bi,
int deltaScale)
Rescale a BigInteger, a positive delta means the scale is increased, zero
no change and negative decrease of scale.
|
void |
setBigDecimal(java.lang.Number theValue)
setValue for integral exact numerics.
|
void |
setValue(java.lang.String theValue)
Set the value from a String, the format is
nnnn
Scale always set to zero.
|
void |
setWidth(int desiredPrecision,
int desiredScale,
boolean errorOnTrunc) |
NumberDataValue |
timesNN(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
Multiple two non-null NumberDataValues using DECIMAL arithmetic.
|
java.lang.String |
toString() |
protected int |
typeCompare(DataValueDescriptor arg)
Compare two non-null NumberDataValues using DECIMAL arithmetic.
|
cloneValue, divide, divide, estimateMemoryUsage, getByte, getDecimalValueScale, getInt, getLength, getShort, getTypeFormatId, getTypeName, hashCode, isNegative, isNull, minus, minusNN, plus, readExternal, restoreToNull, setFrom, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, times, typePrecedence, typeToBigDecimal, writeExternalabsolute, compare, compare, mod, normalizeDOUBLE, normalizeREAL, normalizeREAL, objectNull, setObject, setValue, setValue, sqrtcheckHostVariable, cloneHolder, coalesce, compare, compare, compareTo, dataTypeConversion, equals, equals, flip, genericSetObject, getBytes, getDate, getStream, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, invalidFormat, isNotNull, isNullOp, lessOrEquals, lessThan, notEquals, outOfRange, readExternalFromArray, recycle, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatchclone, finalize, getClass, notify, notifyAll, wait, wait, waitcheckHostVariable, cloneHolder, coalesce, compare, compare, equals, getBytes, getDate, getStream, getTime, getTimestamp, getTraceString, greaterOrEquals, greaterThan, hasStream, in, isNotNull, isNullOp, lessOrEquals, lessThan, notEquals, readExternalFromArray, recycle, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueprivate static final java.math.BigInteger TEN
private static final java.math.BigInteger MAXLONG_PLUS_ONE
private static final java.math.BigInteger MINLONG_MINUS_ONE
public DataValueDescriptor getNewNull()
DataValueDescriptorpublic long getLong()
throws StandardException
DataTypegetLong in interface DataValueDescriptorgetLong in class DataTypeStandardException - Thrown on errorpublic float getFloat()
throws StandardException
DataTypegetFloat in interface DataValueDescriptorgetFloat in class DataTypeStandardException - Thrown on errorpublic double getDouble()
throws StandardException
DataTypegetDouble in interface DataValueDescriptorgetDouble in class DataTypeStandardException - Thrown on errorpublic boolean getBoolean()
DataTypegetBoolean in interface DataValueDescriptorgetBoolean in class DataTypepublic void setValue(java.lang.String theValue)
throws StandardException
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The BigDecimal value to set this DataValueDescriptor toStandardExceptionpublic java.lang.Object getObject()
throws StandardException
DataTypegetObject in interface DataValueDescriptorgetObject in class DataTypeStandardException - Thrown on errorpublic java.lang.String getString()
DataValueDescriptorpublic int getDecimalValuePrecision()
getDecimalValuePrecision in interface NumberDataValuegetDecimalValuePrecision in class NumberDataTypeprotected int typeCompare(DataValueDescriptor arg) throws StandardException
typeCompare in class NumberDataTypeStandardException - Thrown on errorpublic NumberDataValue plusNN(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException
plusNN in class BinaryDecimalStandardExceptionpublic NumberDataValue minus(NumberDataValue result) throws StandardException
result - The result of the previous call to this method, null
if not called yet.StandardException - Thrown on error, if result is non-null then its value will be unchanged.NumberDataValue.minus(org.apache.derby.iapi.types.NumberDataValue)public NumberDataValue timesNN(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException
left * right
= (left_unscaled * 10^-left_scale) * (right_unscaled * 10^-right_scale)
= (left_unscaled * 10^-left_scale) * (right_unscaled * 10^-right_scale)
= (left_unscaled * right_unscaled) * 10^-(left_scale + right_scale)
timesNN in class BinaryDecimalStandardExceptionpublic NumberDataValue divideNN(NumberDataValue left, NumberDataValue right, NumberDataValue result, int scale) throws StandardException
left / right
= (left_unscaled * 10^-left_scale) / (right_unscaled * 10^-right_scale)
= (left_unscaled / right_unscaled) * (10^-left_scale / 10^-right_scale)
= (left_unscaled / right_unscaled) * (10^-(left_scale-right_scale))
divideNN in class BinaryDecimalStandardExceptionpublic void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException
DataTypenormalize in interface DataValueDescriptornormalize in class DataTypedesiredType - The type to normalize the source column tosource - The value to normalizeStandardException - Thrown normalization error.public void setWidth(int desiredPrecision,
int desiredScale,
boolean errorOnTrunc)
throws StandardException
StandardExceptionprivate BigIntegerDecimal getBID(DataValueDescriptor value) throws StandardException
StandardExceptionprivate static java.math.BigInteger rescale(java.math.BigInteger bi,
int deltaScale)
bi - value to be rescaleddeltaScale - change of scalepublic void setBigDecimal(java.lang.Number theValue)
throws StandardException
NumberDataTypesetBigDecimal in interface DataValueDescriptorsetBigDecimal in class NumberDataTypetheValue - required to be a BigDecimal or null.StandardExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.