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, sqlScale
ONE, ZERO, ZERO_DECIMAL
IGNORE_PRECISION
MAX_DECIMAL_PRECISION_SCALE, MIN_DECIMAL_DIVIDE_SCALE
UNKNOWN_LOGICAL_LENGTH
ORDER_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, writeExternal
absolute, compare, compare, mod, normalizeDOUBLE, normalizeREAL, normalizeREAL, objectNull, setObject, setValue, setValue, sqrt
checkHostVariable, 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, throwLangSetMismatch
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
checkHostVariable, 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, setValue
private 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()
DataValueDescriptor
public long getLong() throws StandardException
DataType
getLong
in interface DataValueDescriptor
getLong
in class DataType
StandardException
- Thrown on errorpublic float getFloat() throws StandardException
DataType
getFloat
in interface DataValueDescriptor
getFloat
in class DataType
StandardException
- Thrown on errorpublic double getDouble() throws StandardException
DataType
getDouble
in interface DataValueDescriptor
getDouble
in class DataType
StandardException
- Thrown on errorpublic boolean getBoolean()
DataType
getBoolean
in interface DataValueDescriptor
getBoolean
in class DataType
public void setValue(java.lang.String theValue) throws StandardException
setValue
in interface DataValueDescriptor
setValue
in class DataType
theValue
- The BigDecimal value to set this DataValueDescriptor toStandardException
public java.lang.Object getObject() throws StandardException
DataType
getObject
in interface DataValueDescriptor
getObject
in class DataType
StandardException
- Thrown on errorpublic java.lang.String getString()
DataValueDescriptor
public int getDecimalValuePrecision()
getDecimalValuePrecision
in interface NumberDataValue
getDecimalValuePrecision
in class NumberDataType
protected int typeCompare(DataValueDescriptor arg) throws StandardException
typeCompare
in class NumberDataType
StandardException
- Thrown on errorpublic NumberDataValue plusNN(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException
plusNN
in class BinaryDecimal
StandardException
public 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 BinaryDecimal
StandardException
public 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 BinaryDecimal
StandardException
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException
DataType
normalize
in interface DataValueDescriptor
normalize
in class DataType
desiredType
- 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
StandardException
private BigIntegerDecimal getBID(DataValueDescriptor value) throws StandardException
StandardException
private 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
NumberDataType
setBigDecimal
in interface DataValueDescriptor
setBigDecimal
in class NumberDataType
theValue
- required to be a BigDecimal or null.StandardException
public java.lang.String toString()
toString
in class java.lang.Object
Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.