|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.iapi.types.DataType
org.apache.derby.iapi.types.NumberDataType
public abstract class NumberDataType
NumberDataType is the superclass for all exact and approximate numeric data types. It exists for the purpose of allowing classification of types for supported implicit conversions among them.
DataType
,
Serialized FormField Summary | |
---|---|
(package private) static java.lang.Comparable |
MAXLONG_PLUS_ONE
Set by the booting DataValueFactory implementation. |
(package private) static java.lang.Comparable |
MINLONG_MINUS_ONE
Set by the booting DataValueFactory implementation. |
(package private) static DataValueDescriptor |
ZERO_DECIMAL
Set by the booting DataValueFactory implementation. |
Fields inherited from interface org.apache.derby.iapi.types.NumberDataValue |
---|
MAX_DECIMAL_PRECISION_SCALE, MIN_DECIMAL_DIVIDE_SCALE |
Fields inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
---|
UNKNOWN_LOGICAL_LENGTH |
Fields inherited from interface org.apache.derby.iapi.types.Orderable |
---|
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN |
Constructor Summary | |
---|---|
NumberDataType()
|
Method Summary | |
---|---|
NumberDataValue |
absolute(NumberDataValue result)
Numbers check for isNegative first and negate it if negative. |
int |
compare(DataValueDescriptor arg)
Compare this Orderable with a given Orderable for the purpose of index positioning. |
boolean |
compare(int op,
DataValueDescriptor other,
boolean orderedNulls,
boolean unknownRV)
Compare this Orderable with a given Orderable for the purpose of qualification and sorting. |
NumberDataValue |
divide(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result)
This method implements the / operator for TINYINT, SMALLINT and INTEGER. |
NumberDataValue |
divide(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result,
int scale)
Suitable for integral types that ignore scale. |
int |
getDecimalValuePrecision()
Return the precision of this specific DECIMAL value. |
int |
getDecimalValueScale()
Return the scale of this specific DECIMAL value. |
protected abstract boolean |
isNegative()
The isNegative abstract method. |
NumberDataValue |
minus(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
This method implements the - operator for TINYINT, SMALLINT and INTEGER. |
NumberDataValue |
mod(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result)
The SQL mod operator. |
static double |
normalizeDOUBLE(double v)
normalizeDOUBLE checks the validity of the given java double that it fits within the range of DB2 DOUBLEs. |
static float |
normalizeREAL(double v)
normalizeREAL checks the validity of the given java double that it fits within the range of DB2 REALs. |
static float |
normalizeREAL(float v)
normalizeREAL checks the validity of the given java float that it fits within the range of DB2 REALs. |
protected boolean |
objectNull(java.lang.Object o)
|
NumberDataValue |
plus(NumberDataValue addend1,
NumberDataValue addend2,
NumberDataValue result)
This method implements the + operator for TINYINT,SMALLINT,INT. |
void |
setBigDecimal(java.lang.Number bigDecimal)
setValue for integral exact numerics. |
(package private) void |
setObject(java.lang.Object theValue)
Set the value from a correctly typed Integer object. |
void |
setValue(byte theValue)
Common code to handle converting a byte to this value by using the int to this value conversion. |
void |
setValue(java.lang.Number theValue)
Common code to handle java.lang.Integer as a Number, used for TINYINT, SMALLINT, INTEGER |
void |
setValue(short theValue)
Common code to handle converting a short to this value by using the int to this value conversion. |
NumberDataValue |
sqrt(NumberDataValue result)
This is the sqrt method. |
protected abstract int |
typeCompare(DataValueDescriptor arg)
Compare this (not null) to a non-null value. |
int |
typeToBigDecimal()
Implementation for integral types. |
Methods inherited from class org.apache.derby.iapi.types.DataType |
---|
checkHostVariable, cloneHolder, coalesce, compare, compare, compareTo, dataTypeConversion, equals, equals, flip, genericSetObject, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getNationalString, getObject, getShort, getStream, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, invalidFormat, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, outOfRange, recycle, setFrom, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch, typePrecedence |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.types.NumberDataValue |
---|
minus, times |
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
---|
checkHostVariable, cloneHolder, cloneValue, coalesce, compare, compare, equals, estimateMemoryUsage, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLength, getLong, getNewNull, getObject, getShort, getStream, getString, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, readExternalFromArray, recycle, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, typePrecedence |
Methods inherited from interface org.apache.derby.iapi.services.io.Storable |
---|
isNull, restoreToNull |
Methods inherited from interface java.io.Externalizable |
---|
readExternal, writeExternal |
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat |
---|
getTypeFormatId |
Field Detail |
---|
static DataValueDescriptor ZERO_DECIMAL
static java.lang.Comparable MINLONG_MINUS_ONE
static java.lang.Comparable MAXLONG_PLUS_ONE
Constructor Detail |
---|
public NumberDataType()
Method Detail |
---|
public final NumberDataValue absolute(NumberDataValue result) throws StandardException
absolute
in interface NumberDataValue
result
- The result of the previous call to this method, null
if not called yet.
StandardException
- thrown on error.public NumberDataValue sqrt(NumberDataValue result) throws StandardException
sqrt
in interface NumberDataValue
result
- The result of the previous call to this method, null
if not call yet.
StandardException
- thrown on a negative number.public NumberDataValue plus(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result) throws StandardException
plus
in interface NumberDataValue
addend1
- One of the addendsaddend2
- The other addendresult
- The result of a previous call to this method, null
if not called yet
StandardException
- Thrown on errorpublic NumberDataValue minus(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException
minus
in interface NumberDataValue
left
- The value to be subtracted fromright
- The value to be subtractedresult
- The result of a previous call to this method, null
if not called yet
StandardException
- Thrown on errorpublic NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException
divide
in interface NumberDataValue
dividend
- The numeratordivisor
- The denominatorresult
- The result of a previous call to this method, null
if not called yet
StandardException
- Thrown on errorpublic NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale) throws StandardException
divide
in interface NumberDataValue
dividend
- The numeratordivisor
- The denominatorresult
- The result of the previous call to this method, null
if not called yet.scale
- The scale of the result, for decimal type. If pass
in value < 0, can calculate it dynamically.
StandardException
- Thrown on error, if result is non-null then its value will be unchanged.public NumberDataValue mod(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException
NumberDataValue
mod
in interface NumberDataValue
dividend
- The numeratordivisor
- The denominatorresult
- 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.public final int compare(DataValueDescriptor arg) throws StandardException
DataValueDescriptor
compare
in interface DataValueDescriptor
arg
- The Orderable to compare this one to.
StandardException
- Thrown on errorprotected abstract int typeCompare(DataValueDescriptor arg) throws StandardException
StandardException
- Thrown on errorpublic final boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException
DataValueDescriptor
compare
in interface DataValueDescriptor
compare
in class DataType
op
- Orderable.ORDER_OP_EQUALS means do an = comparison.
Orderable.ORDER_OP_LESSTHAN means compare this < other.
Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.other
- The DataValueDescriptor to compare this one to.orderedNulls
- True means to treat nulls as ordered values,
that is, treat SQL null as equal to null, and less
than all other values.
False means to treat nulls as unknown values,
that is, the result of any comparison with a null
is the UNKNOWN truth value.unknownRV
- The return value to use if the result of the
comparison is the UNKNOWN truth value. In other
words, if orderedNulls is false, and a null is
involved in the comparison, return unknownRV.
This parameter is not used orderedNulls is true.
StandardException
- thrown on errorprotected abstract boolean isNegative()
public void setValue(short theValue) throws StandardException
setValue
in interface DataValueDescriptor
setValue
in class DataType
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(byte theValue) throws StandardException
setValue
in interface DataValueDescriptor
setValue
in class DataType
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(java.lang.Number theValue) throws StandardException
setValue
in interface NumberDataValue
theValue
- An Number containing the value to set this
NumberDataValue to. Null means set the value
to SQL null.
StandardException
- Thrown on errorNumberDataValue.setValue(java.lang.Number)
void setObject(java.lang.Object theValue) throws StandardException
setObject
in class DataType
StandardException
public void setBigDecimal(java.lang.Number bigDecimal) throws StandardException
setBigDecimal
in interface DataValueDescriptor
setBigDecimal
in class DataType
bigDecimal
- required to be a BigDecimal or null.
StandardException
public int typeToBigDecimal()
typeToBigDecimal
in interface DataValueDescriptor
typeToBigDecimal
in class DataType
public int getDecimalValuePrecision()
getDecimalValuePrecision
in interface NumberDataValue
public int getDecimalValueScale()
getDecimalValueScale
in interface NumberDataValue
protected final boolean objectNull(java.lang.Object o)
public static float normalizeREAL(float v) throws StandardException
StandardException
public static float normalizeREAL(double v) throws StandardException
StandardException
public static double normalizeDOUBLE(double v) throws StandardException
StandardException
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |