Package com.mckoi.database
Class TNumericType
java.lang.Object
com.mckoi.database.TType
com.mckoi.database.TNumericType
- All Implemented Interfaces:
Serializable
An implementation of TType for a number.
- Author:
- Tobias Downer
- See Also:
-
Field Summary
Fields inherited from class com.mckoi.database.TType
ARRAY_TYPE, BINARY_TYPE, BOOLEAN_TYPE, DATE_TYPE, NULL_TYPE, NUMERIC_TYPE, QUERY_PLAN_TYPE, STRING_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionTNumericType
(int sql_type, int size, int scale) Constructs a type with the given sql_type value, the size, and the scale of the number. -
Method Summary
Modifier and TypeMethodDescriptionint
Calculates the approximate memory usage of an object of this type in bytes.boolean
comparableTypes
(TType type) Returns true if the type of this object is logically comparable to the type of the given object.int
compareObs
(Object ob1, Object ob2) Compares two objects that are logically comparable under this type.int
getScale()
Returns the scale of the number (-1 is don't care).int
getSize()
Returns the size of the number (-1 is don't care).Returns the Java Class that is used to represent this type of object.Methods inherited from class com.mckoi.database.TType
asEncodedString, asEncodedString, asSQLString, binaryType, booleanType, castObjectToTType, dateType, decodeString, decodeTypes, fromClass, getSQLType, getWidestType, javaObjectType, numericType, stringType
-
Constructor Details
-
TNumericType
public TNumericType(int sql_type, int size, int scale) Constructs a type with the given sql_type value, the size, and the scale of the number. Note that the 'sql_type' MUST be a numeric SQL type (FLOAT, INTEGER, DOUBLE, etc).
-
-
Method Details
-
getSize
public int getSize()Returns the size of the number (-1 is don't care). -
getScale
public int getScale()Returns the scale of the number (-1 is don't care). -
comparableTypes
Description copied from class:TType
Returns true if the type of this object is logically comparable to the type of the given object. For example, VARCHAR and LONGVARCHAR are comparable types. DOUBLE and FLOAT are comparable types. DOUBLE and VARCHAR are not comparable types.- Specified by:
comparableTypes
in classTType
-
compareObs
Description copied from class:TType
Compares two objects that are logically comparable under this type. Returns 0 if the values are equal, >1 if ob1 is greater than ob2, and <1 if ob1 is less than ob2. It is illegal to pass NULL values for ob1 or ob2 into this method.- Specified by:
compareObs
in classTType
-
calculateApproximateMemoryUse
Description copied from class:TType
Calculates the approximate memory usage of an object of this type in bytes.- Specified by:
calculateApproximateMemoryUse
in classTType
-
javaClass
Description copied from class:TType
Returns the Java Class that is used to represent this type of object. For example, string types would return String.class.
-