|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.sql.Datum | +--oracle.sql.NUMBER
NUMBER Class
The NUMBER class provides converisons between the Oracle Number (lnxnum_t) data type and Java types byte[], byte, short, integer, long, float, double, String, BigInteger. and BigDecimal.
The internal data for this object is stored as a byte array in the super class' storage area.
Static methods are used for conversions.
The LNX length included format is not supported. The byte array passed to
or returned by any method is assumed to have the proper length
accessible by the byte[].length
instance variable.
Constructor Summary | |
NUMBER()
Constructs a NUMBER object initialized to zero. |
|
NUMBER(java.math.BigDecimal BigDecNum)
Constructs a NUMBER object initialized to the specified BigDecimal value. |
|
NUMBER(java.math.BigInteger BigIntNum)
Constructs a NUMBER object initialized to the specified BigInteger value. |
|
NUMBER(boolean boolNum)
Constructs a Number object initialized to the specified boolean value. |
|
NUMBER(byte byteNum)
Constructs a Number object initialized to the specified byte value. |
|
NUMBER(byte[] num)
Constructs a NUMBER object initialized to the value specified by the byte array. |
|
NUMBER(double doubleNum)
Constructs a Number object initialized to the specified double value. |
|
NUMBER(float floatNum)
Constructs a Number object initialized to the specified float value. |
|
NUMBER(int intNum)
Constructs a Number object initialized to the specified integer value. |
|
NUMBER(long longNum)
Constructs a Number object initialized to the specified long value. |
|
NUMBER(java.lang.Object obj)
Constructs a NUMBER object initialized to the value specified by the object |
|
NUMBER(short shortNum)
Constructs a Number object initialized to the specified short value. |
|
NUMBER(java.lang.String StringNum,
int scale)
Constructs a NUMBER object initialized to the specified String value. |
Method Summary | |
NUMBER |
abs()
Returns a new NUMBER object initialized to the absolute value of NUMBER. |
NUMBER |
acos()
Returns a new NUMBER object initialized to the arc cosine value of NUMBER. |
NUMBER |
add(NUMBER n)
Returns a new NUMBER object initialized to the value of the addition of the NUMBER value and n. |
NUMBER |
asin()
Returns a new NUMBER object initialized to the arc sine value of NUMBER. |
NUMBER |
atan()
Returns a new NUMBER object initialized to the arc tangent value of NUMBER. |
NUMBER |
atan2(NUMBER x)
Returns a new NUMBER object initialized to the value of atan2(NUMBER/x). |
java.math.BigDecimal |
bigDecimalValue()
Calls toBigDecimalto convert internal Oracle Number into a Java BigDecimal. |
java.math.BigInteger |
bigIntegerValue()
Calls toBigInteger to convert internal Oracle Number to a Java BigInteger. |
boolean |
booleanValue()
Calls toBoolean to convert internal Oracle Number to a Java boolean. |
byte |
byteValue()
Calls toByte to convert internal Oracle Number to a Java byte. |
NUMBER |
ceil()
Returns a new NUMBER object initialized to the ceiling of NUMBER value. |
int |
compareTo(NUMBER n)
Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n. |
NUMBER |
cos()
Returns a new NUMBER object initialized to the cosine value of NUMBER. |
NUMBER |
cosh()
Returns a new NUMBER object initialized to the hyperbolic cosine value of NUMBER. |
NUMBER |
decrement()
Returns a new NUMBER object initialized to the NUMBER value decremented by 1. |
NUMBER |
div(NUMBER n)
Returns a new NUMBER object initialized to the division of NUMBER value by n. |
double |
doubleValue()
Calls toDouble to convert internal Oracle Number to a Java double. |
static NUMBER |
e()
Returns a new NUMBER object initialized to the value of e. |
NUMBER |
exp()
Returns a new NUMBER object initialized to the value of e raised to NUMBER value. |
NUMBER |
floatingPointRound(int precision)
Returns a new NUMBER object initialized to Number rounded to precision significant decimal digits. |
float |
floatValue()
Calls toFloat to convert internal Oracle Number to a Java float. |
NUMBER |
floor()
Returns a new NUMBER object initialized to the floor of NUMBER value. |
static NUMBER |
formattedTextToNumber(java.lang.String num,
java.lang.String fmt,
java.lang.String lang)
Returns a NUMBER converted from Num controlled by the format fmt. |
NUMBER |
increment()
Returns a new NUMBER object initialized to the NUMBER value incremented by 1. |
int |
intValue()
Calls toInt to convert internal Oracle Number to a Java int. |
boolean |
isConvertibleTo(java.lang.Class cls)
Determines if the object can be converted to a particular class |
boolean |
isInf()
Returns true if NUMBER value is positive or negative infinity and a false otherwise. |
boolean |
isInt()
Returns true if NUMBER value is finite and integral. |
boolean |
isNegInf()
Returns returns true if NUMBER is negative infinity and false otherwise. |
boolean |
isPosInf()
Returns true if NUMBER is positive infinity and false otherwise. |
static boolean |
isValid(byte[] num)
Checks if a given Oracle Number is valid |
boolean |
isZero()
Returns true if NUMBER is zero. |
NUMBER |
ln()
Returns a new NUMBER object initialized to the natural logarithm of the NUMBER value. |
static NUMBER |
ln10()
Returns a new NUMBER object initialized to the value of ln(10). |
NUMBER |
log(NUMBER base)
Returns a new NUMBER object initialized to the logarithm to the base base of the NUMBER value. |
long |
longValue()
Calls toLong to convert internal Oracle Number to a Java long. |
java.lang.Object |
makeJdbcArray(int arraySize)
Returns a JDBC array representation of the datum |
NUMBER |
mod(NUMBER n)
Returns a new NUMBER object initialized to the remainder of the division of NUMBER/n. |
NUMBER |
mul(NUMBER n)
Returns a new NUMBER object initialized to product of NUMBER and n. |
NUMBER |
negate()
Returns a new NUMBER object initialized to the negated NUMBER value. |
static NUMBER |
negInf()
Returns a new NUMBER object initialized to negative infinity. |
static NUMBER |
pi()
Returns a new NUMBER object initialized to the value of pi. |
static NUMBER |
posInf()
Returns a new NUMBER object initialized to positive infinity. |
NUMBER |
pow(int exp)
Returns a new NUMBER object initialized to NUMBER value raised to the exp power. |
NUMBER |
pow(NUMBER exp)
Returns a new NUMBER object initialized to the value of NUMBER value raised to the exp power. |
NUMBER |
round(int decimal_place)
Returns a new NUMBER object initialized to the NUMBER value rounded to specified decimal place decimal_place. |
NUMBER |
scale(int left,
int right,
boolean[] big)
Returns a new NUMBER object initialized to the value determined by the rounding performed based on the right parameter below. |
NUMBER |
shift(int digits)
Returns a new NUMBER object initialized the NUMBER value shifted digits decimal places. |
short |
shortValue()
Calls toShort to convert internal Oracle Number to a Java short. |
int |
sign()
Returns -1 if the sign of NUMBER is negative, 0 if NUMBER is 0, and > 0 if NUMBER is positive. |
NUMBER |
sin()
Returns a new NUMBER object initialized to the sine of the NUMBER. |
NUMBER |
sinh()
Returns a new NUMBER object initialized to the hyperbolic sine of NUMBER. |
NUMBER |
sqroot()
Returns a new NUMBER object initialized to the square root of NUMBER. |
java.lang.String |
stringValue()
Calls toString to convert internal Oracle Number to a Java String. |
NUMBER |
sub(NUMBER n)
Returns a new NUMBER object initialized to the difference of NUMBER and n. |
NUMBER |
tan()
Returns a new NUMBER object initialized to the tangent of NUMBER. |
NUMBER |
tanh()
Returns a new NUMBER object initialized to the hyperbolic tangent of Number. |
static NUMBER |
textToPrecisionNumber(java.lang.String num,
boolean precflag,
int preclen,
boolean scaleflag,
int scalelen,
java.lang.String lang)
Returns a NUMBER object initialized to the value in num as described below. |
static java.math.BigDecimal |
toBigDecimal(byte[] num)
Converts an Oracle Number into a Java BigDecimal. |
static java.math.BigInteger |
toBigInteger(byte[] num)
Converts an Oracle Number into a Java BigInteger. |
static boolean |
toBoolean(byte[] num)
Convert an Oracle Number to a Java boolean. |
static byte |
toByte(byte[] num)
Converts an Oracle Number into a Java byte. |
byte[] |
toBytes()
Returns the internal Oracle Number byte array. |
static byte[] |
toBytes(java.math.BigDecimal BigDecNum)
Converts a Java BigDecimal to an Oracle Number byte array. |
static byte[] |
toBytes(java.math.BigInteger BigIntNum)
Converts a Java BigInteger to an Oracle Number byte array. |
static byte[] |
toBytes(boolean boolNum)
Converts a Java boolean to an Oracle Number byte array. |
static byte[] |
toBytes(byte byteNum)
Converts a Java byte to an Oracle Number byte array. |
static byte[] |
toBytes(double doubleNum)
Converts a Java double to an Oracle Number byte array. |
static byte[] |
toBytes(float floatNum)
Converts a Java float to an Oracle Number byte array. |
static byte[] |
toBytes(int intNum)
Converts a Java int to an Oracle Number byte array. |
static byte[] |
toBytes(long longNum)
Converts a Java long to an Oracle Number byte array. |
static byte[] |
toBytes(short shortNum)
Converts a Java short to an Oracle Number byte array. |
static byte[] |
toBytes(java.lang.String StringNum,
int scale)
Converts a Java String to an Oracle Number byte array. |
static double |
toDouble(byte[] num)
Converts an Oracle Number into a Java double. |
static float |
toFloat(byte[] num)
Converts an Oracle Number into a Java float. |
java.lang.String |
toFormattedText(java.lang.String fmt,
java.lang.String lang)
Returns a new String based on the format specified in fmt and NUMBER. |
static int |
toInt(byte[] num)
Converts an Oracle Number into a Java int. |
java.lang.Object |
toJdbc()
Returns the JDBC representation of the datum object |
static long |
toLong(byte[] num)
Converts an Oracle Number into a Java long. |
static short |
toShort(byte[] num)
Converts an Oracle Number into a Java xemacs short. |
static java.lang.String |
toString(byte[] num)
Convert an Oracle Number to a Java String. |
java.lang.String |
toText(int outStringLength,
java.lang.String lang)
Returns a String with the unformatted representation of NUMBER. |
NUMBER |
truncate(int decimal_place)
Returns a new NUMBER object initialized to the NUMBER value truncated to specified decimal place decimal_place. |
static NUMBER |
zero()
Returns a new NUMBER object initialized to zero. |
Methods inherited from class oracle.sql.Datum |
asciiStreamValue,
binaryStreamValue,
characterStreamValue,
dateValue,
equals,
getBytes,
getLength,
getStream,
setBytes,
setShareBytes,
shareBytes,
timestampValue,
timeValue |
Methods inherited from class java.lang.Object |
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public NUMBER()
public NUMBER(byte[] num)
a.length
is the
length of the Oracle Number in bytes.num
- Oracle Number in byte array formatpublic NUMBER(byte byteNum)
byteNum
- The Java byte valuepublic NUMBER(int intNum)
intNum
- The Java integer valuepublic NUMBER(long longNum)
longNum
- The Java long valuepublic NUMBER(short shortNum)
shortNum
- The Java short valuepublic NUMBER(float floatNum)
floatNum
- The Java float valuepublic NUMBER(double doubleNum) throws java.sql.SQLException
doubleNum
- The Java double valuepublic NUMBER(java.math.BigDecimal BigDecNum) throws java.sql.SQLException
Since there doesn't seem to be a way to represent +-inf using a BigDecimal this condition isn't considered.
Notes:
BigDecNum
- The BigDecimal used to initialize NUMBER.public NUMBER(java.math.BigInteger BigIntNum) throws java.sql.SQLException
BigIntNum
- The Java BigInteger from which to construct the
Oracle number.public NUMBER(java.lang.String StringNum, int scale) throws java.sql.SQLException
StringNum
- The Java String from which to construct the
Oracle number.scale
- scale to usepublic NUMBER(boolean boolNum)
boolNum
- The Java boolean valuepublic NUMBER(java.lang.Object obj) throws java.sql.SQLException
obj
- Object valueMethod Detail |
public static double toDouble(byte[] num)
num
- Oracle Number in byte array formatpublic static float toFloat(byte[] num)
num
- Oracle Number in byte array formatpublic static long toLong(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static int toInt(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static short toShort(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static byte toByte(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static java.math.BigInteger toBigInteger(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static java.math.BigDecimal toBigDecimal(byte[] num) throws java.sql.SQLException
num
- Oracle Number in byte array formatpublic static java.lang.String toString(byte[] num)
num
- Oracle Number in byte array formatpublic static boolean toBoolean(byte[] num)
false
and non-zero values
translate to true
,num
- Oracle Number in byte array formatpublic static byte[] toBytes(double doubleNum) throws java.sql.SQLException
doubleNum
- Java double valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(float floatNum)
floatNum
- Java float valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(long longNum)
longNum
- Java long valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(int intNum)
intNum
- Java int valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(short shortNum)
shortNum
- Java short valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(byte byteNum)
byteNum
- Java byte valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(java.math.BigInteger BigIntNum) throws java.sql.SQLException
BigIntNum
- Java BigInteger valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(java.math.BigDecimal BigDecNum) throws java.sql.SQLException
BigDecNum
- Java BigDecimal valuelength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(java.lang.String StringNum, int scale) throws java.sql.SQLException
Notes:
StringNum
- Java String valuescale
- scale to uselength
instance variable holds Oracle Number
length in bytes.public static byte[] toBytes(boolean boolNum)
true
value translates to 1 and a false
value translates to 0.boolNum
- Java boolean valuelength
instance variable holds Oracle Number
length in bytes.public byte[] toBytes()
length
instance variable holds Oracle Number
length in bytes.public double doubleValue()
public float floatValue()
public long longValue() throws java.sql.SQLException
public int intValue() throws java.sql.SQLException
public short shortValue() throws java.sql.SQLException
public byte byteValue() throws java.sql.SQLException
public java.math.BigInteger bigIntegerValue() throws java.sql.SQLException
public java.math.BigDecimal bigDecimalValue() throws java.sql.SQLException
public java.lang.String stringValue()
public boolean booleanValue()
public java.lang.Object toJdbc() throws java.sql.SQLException
public java.lang.Object makeJdbcArray(int arraySize)
arraySize
- size of the arraypublic boolean isConvertibleTo(java.lang.Class cls)
cls
- Class to convert topublic NUMBER abs() throws java.sql.SQLException
public NUMBER acos() throws java.sql.SQLException
public NUMBER add(NUMBER n) throws java.sql.SQLException
n
- input Oracle Numberpublic NUMBER asin() throws java.sql.SQLException
public NUMBER atan() throws java.sql.SQLException
public NUMBER atan2(NUMBER x) throws java.sql.SQLException
x
- input Oracle Numberpublic NUMBER ceil() throws java.sql.SQLException
public NUMBER cos() throws java.sql.SQLException
public NUMBER cosh() throws java.sql.SQLException
public NUMBER decrement() throws java.sql.SQLException
public NUMBER div(NUMBER n) throws java.sql.SQLException
n
- input Oracle Numberpublic NUMBER exp() throws java.sql.SQLException
public NUMBER floatingPointRound(int precision) throws java.sql.SQLException
precision
- input precisionpublic NUMBER floor() throws java.sql.SQLException
public NUMBER increment() throws java.sql.SQLException
public NUMBER ln() throws java.sql.SQLException
public NUMBER log(NUMBER base) throws java.sql.SQLException
base
- Base for calculating logarithmpublic NUMBER mod(NUMBER n) throws java.sql.SQLException
n
- input Oracle Numberpublic NUMBER mul(NUMBER n) throws java.sql.SQLException
n
- input Oracle Numberpublic NUMBER negate() throws java.sql.SQLException
public NUMBER pow(NUMBER exp) throws java.sql.SQLException
exp
- input Oracle Number exponentpublic NUMBER pow(int exp) throws java.sql.SQLException
exp
- input integral exponentpublic NUMBER round(int decimal_place) throws java.sql.SQLException
decimal_place
- decimal place to round topublic NUMBER scale(int left, int right, boolean[] big) throws java.sql.SQLException
left
- maximum number of decimal digits to the left of the
decimal point. It will not effect the number but big
will return true if this value is exceeded.right
- maximum number of decimal digits to the right of the
decimal point. The number is rounded at this point.
Negative values are allowed.big
- set to true if the number of left-hand-side digits is
exceeded and false otherwise. If big is null, it is
left unset.public NUMBER shift(int digits) throws java.sql.SQLException
digits
- number of decimal places to shift. Can be negative.
Positive values shift the decimal place to the right
and negative values to the left. For example, if
NUMBER corresponds to 1234.5 and digits == -1, the new
NUMBER object will correspond to 123.45.public NUMBER sin() throws java.sql.SQLException
public NUMBER sinh() throws java.sql.SQLException
public NUMBER sqroot() throws java.sql.SQLException
public NUMBER sub(NUMBER n) throws java.sql.SQLException
n
- input Oracle Numberpublic NUMBER tan() throws java.sql.SQLException
public NUMBER tanh() throws java.sql.SQLException
public NUMBER truncate(int decimal_place) throws java.sql.SQLException
decimal_place
- decimal place to truncate topublic static NUMBER formattedTextToNumber(java.lang.String num, java.lang.String fmt, java.lang.String lang) throws java.sql.SQLException
num
- input string representing a numeric valuefmt
- format string [see "Oracle 8 Server Concepts
Manual" or "CORE User's Guide Appendix D"]lang
- the NLS language the conversion is to be
performed in, null indicates use default.public static NUMBER textToPrecisionNumber(java.lang.String num, boolean precflag, int preclen, boolean scaleflag, int scalelen, java.lang.String lang) throws java.sql.SQLException
num
- input string representing a numeric valueprecflag
- if true, then a precision restriction should be
appliedpreclen
- the maximum number of the decimal digits the
NUMBER may have, subject to the scale
requirement. The number is NOT rounded if more
than preclen decimal digits must be placed in
the number to meet the scale requirement. ncp
is set to 0 if the precision restriction is
violated. preclen is ignored if precflag is false.scaleflag
- if true then scale restriction should be appliedscalelen
- the maximum number of decimal digits to the right
of the decimal point in the NUMBER Negative
values are allowed. Any excess digits are rounded
off, this is not reported. If enough digits are
available in the input, the maximum digits will
be written to the right of the decimal place even
if the percussion restriction is violated.
scalelen is ignored if scaleflag is false. if
precision is specified but scale is not, the
scale is assumed to be 0.lang
- the NLS language the conversion is to be
performed in, null indicates use default.public java.lang.String toFormattedText(java.lang.String fmt, java.lang.String lang) throws java.sql.SQLException
For pure Java implementation only Notes:
fmt
- format string [see "Oracle 8 Server Concepts
Manual" or "CORE User's Guide Appendix D"]lang
- the NLS language the conversion is to be
performed in, null indicates use default.public java.lang.String toText(int outStringLength, java.lang.String lang) throws java.sql.SQLException
outStringLength
- |outStringLength| is the length
of the result string.
If outStringLength < 0, the result
string is in scientific notation.lang
- the NLS language the conversion is to be
performed in, null indicates use default.public int compareTo(NUMBER n)
n
- input Oracle Numberpublic boolean isInf()
public boolean isNegInf()
public boolean isPosInf()
public boolean isInt()
public static boolean isValid(byte[] num)
num
- input Oracle Numberpublic boolean isZero()
public static NUMBER e()
public static NUMBER ln10()
public static NUMBER negInf()
public static NUMBER pi()
public static NUMBER posInf()
public static NUMBER zero()
public int sign()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |