|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
org.apache.hadoop.hive.common.type.SignedInt128
public final class SignedInt128
This code was originally written for Microsoft PolyBase.
Represents a signed 128-bit integer. This object is much faster and more
compact than BigInteger, but has many limitations explained in
UnsignedInt128. In short, this class is a thin wrapper for
UnsignedInt128 to make it signed. This object can be used to
represent a few SQL data types, such as DATETIMEOFFSET in SQLServer.
| Field Summary | |
|---|---|
static SignedInt128 |
MAX_VALUE
Maximum value that can be represented in this class. |
static SignedInt128 |
MIN_VALUE
Minimum value that can be represented in this class. |
| Constructor Summary | |
|---|---|
SignedInt128()
Empty constructor to construct zero. |
|
SignedInt128(char[] str,
int offset,
int length)
Constructs from the given string with given offset and length. |
|
SignedInt128(int v0,
int v1,
int v2,
int v3)
Construct this object from the given integers. |
|
SignedInt128(long v)
Construct this object from a long value. |
|
SignedInt128(SignedInt128 o)
Copy Constructor. |
|
SignedInt128(String str)
Constructs from the given string. |
|
SignedInt128(UnsignedInt128 mag)
Construct this object from UnsignedInt128. |
|
| Method Summary | |
|---|---|
static void |
abs(SignedInt128 left,
SignedInt128 result)
This version returns the result as a new object, not modifying the give objects. |
void |
absDestructive()
Makes this object positive. |
static void |
add(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
Calculates addition and puts the result into the given object. |
void |
addDestructive(SignedInt128 right)
Calculates addition and stores the result into this object. |
int |
compareTo(SignedInt128 o)
|
static void |
decrement(SignedInt128 left,
SignedInt128 result)
This version returns the result as a new object, not modifying the give objects. |
void |
decrementDestructive()
Subtracts one from this value. |
static void |
divide(SignedInt128 left,
SignedInt128 right,
SignedInt128 quotient,
SignedInt128 remainder)
Performs division and puts the quotient into the given object. |
int |
divideDestructive(int right)
Divides this value with the given value. |
void |
divideDestructive(SignedInt128 right,
SignedInt128 remainder)
Performs division and puts the quotient into this object. |
double |
doubleValue()
|
boolean |
equals(Object obj)
|
boolean |
equals(SignedInt128 o)
Specialized version. |
float |
floatValue()
|
static int |
getIntsPerElement(int precision)
Determines the number of ints to store one value. |
int |
getV0()
|
int |
getV1()
|
int |
getV2()
|
int |
getV3()
|
int |
hashCode()
|
static void |
increment(SignedInt128 left,
SignedInt128 result)
This version returns the result as a new object, not modifying the give objects. |
void |
incrementDestructive()
Adds one to this value. |
int |
intValue()
|
boolean |
isZero()
|
long |
longValue()
|
static void |
multiply(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
Calculates multiplication and puts the result into the given object. |
void |
multiplyDestructive(int right)
Performs multiplication. |
void |
multiplyDestructive(SignedInt128 right)
Performs multiplication. |
static void |
negate(SignedInt128 left,
SignedInt128 result)
This version returns the result as a new object, not modifying the give objects. |
void |
negateDestructive()
Reverses the sign of this object. |
static void |
scaleDownTen(SignedInt128 left,
SignedInt128 result,
short tenScale)
This version returns the result as a new object, not modifying the give objects. |
void |
scaleDownTenDestructive(short tenScale)
Scale down the value for 10**tenScale (this := this / 10**tenScale). |
static void |
scaleUpTen(SignedInt128 left,
SignedInt128 result,
short tenScale)
This version returns the result as a new object, not modifying the give objects. |
void |
scaleUpTenDestructive(short tenScale)
Scale up the value for 10**tenScale (this := this * 10**tenScale). |
void |
serializeTo128(int[] array,
int offset)
Serializes the value of this object to the given array, putting 128 bits data (full ranges). |
void |
serializeTo128(IntBuffer buf)
Serializes the value of this object to ByteBuffer, putting 128 bits data (full ranges). |
void |
serializeTo32(int[] array,
int offset)
Serializes the value of this object to the given array, putting only 32 bits data. |
void |
serializeTo32(IntBuffer buf)
Serializes the value of this object to ByteBuffer, putting only 32 bits data. |
void |
serializeTo64(int[] array,
int offset)
Serializes the value of this object to the given array, putting only 64 bits data. |
void |
serializeTo64(IntBuffer buf)
Serializes the value of this object to ByteBuffer, putting only 64 bits data. |
void |
serializeTo96(int[] array,
int offset)
Serializes the value of this object to the given array, putting only 96 bits data. |
void |
serializeTo96(IntBuffer buf)
Serializes the value of this object to ByteBuffer, putting only 96 bits data. |
static void |
shiftLeft(SignedInt128 left,
SignedInt128 result,
int bits)
This version returns the result as a new object, not modifying the give objects. |
void |
shiftLeftDestructive(int bits)
Left-shift for the given number of bits. |
static void |
shiftRight(SignedInt128 left,
SignedInt128 result,
int bits,
boolean roundUp)
This version returns the result as a new object, not modifying the give objects. |
void |
shiftRightDestructive(int bits,
boolean roundUp)
Right-shift for the given number of bits. |
static void |
subtract(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
Calculates subtraction and puts the result into the given object. |
void |
subtractDestructive(SignedInt128 right)
Calculates subtraction and stores the result into this object. |
BigInteger |
toBigIntegerSlow()
Convert this object to BigInteger. |
String |
toFormalString()
Returns the formal string representation of this value. |
String |
toString()
|
void |
update(char[] str,
int offset,
int length)
Updates the value of this object from the given string with given offset and length. |
void |
update(long v)
Update this object with the given long value. |
void |
update(SignedInt128 o)
Update this object with the value of the given object. |
void |
update(String str)
Updates the value of this object with the given string. |
void |
update128(int[] array,
int offset)
Updates the value of this object by reading from the given array, receiving 128 bits data (full ranges). |
void |
update128(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving 128 bits data (full ranges). |
void |
update128(int v0,
int v1,
int v2,
int v3)
Update this object with the given integers, receiving 128 bits data (full ranges). |
void |
update32(int v0)
Update this object with the given integers, receiving only 32 bits data. |
void |
update32(int[] array,
int offset)
Updates the value of this object by reading from the given array, receiving only 32 bits data. |
void |
update32(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only 32 bits data. |
void |
update64(int[] array,
int offset)
Updates the value of this object by reading from the given array, receiving only 64 bits data. |
void |
update64(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only 64 bits data. |
void |
update64(int v0,
int v1)
Update this object with the given integers, receiving only 64 bits data. |
void |
update96(int[] array,
int offset)
Updates the value of this object by reading from the given array, receiving only 96 bits data. |
void |
update96(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only 96 bits data. |
void |
update96(int v0,
int v1,
int v2)
Update this object with the given integers, receiving only 96 bits data. |
void |
zeroClear()
Make the value to zero. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final SignedInt128 MAX_VALUE
public static final SignedInt128 MIN_VALUE
| Constructor Detail |
|---|
public SignedInt128()
public SignedInt128(long v)
v - long valuepublic SignedInt128(UnsignedInt128 mag)
mag - UnsignedInt128 objectpublic SignedInt128(SignedInt128 o)
o - object to copy from
public SignedInt128(int v0,
int v1,
int v2,
int v3)
v0 - v0v1 - v1v2 - v2v3 - v3public SignedInt128(String str)
str - string
public SignedInt128(char[] str,
int offset,
int length)
str - stringoffset - offsetlength - length| Method Detail |
|---|
public static int getIntsPerElement(int precision)
precision - precision (0-38)
public int getV0()
public int getV1()
public int getV2()
public int getV3()
public void zeroClear()
public void update(long v)
v - long valuepublic void update(SignedInt128 o)
o - object to copy frompublic void update(String str)
str - string
public void update(char[] str,
int offset,
int length)
str - stringoffset - offsetlength - length
public void update128(int v0,
int v1,
int v2,
int v3)
v0 - v0v1 - v1v2 - v2v3 - v3
public void update96(int v0,
int v1,
int v2)
v0 - v0v1 - v1v2 - v2
public void update64(int v0,
int v1)
v0 - v0v1 - v1public void update32(int v0)
v0 - v0
public void update128(int[] array,
int offset)
array - array to read values fromoffset - offset of the int array
public void update96(int[] array,
int offset)
array - array to read values fromoffset - offset of the int array
public void update64(int[] array,
int offset)
array - array to read values fromoffset - offset of the int array
public void update32(int[] array,
int offset)
array - array to read values fromoffset - offset of the int arraypublic void update128(IntBuffer buf)
buf - ByteBuffer to read values frompublic void update96(IntBuffer buf)
buf - ByteBuffer to read values frompublic void update64(IntBuffer buf)
buf - ByteBuffer to read values frompublic void update32(IntBuffer buf)
buf - ByteBuffer to read values from
public void serializeTo128(int[] array,
int offset)
array - array to useoffset - offset of the int array
public void serializeTo96(int[] array,
int offset)
array - array to useoffset - offset of the int array
public void serializeTo64(int[] array,
int offset)
array - array to useoffset - offset of the int array
public void serializeTo32(int[] array,
int offset)
array - array to useoffset - offset of the int arraypublic void serializeTo128(IntBuffer buf)
buf - ByteBuffer to usepublic void serializeTo96(IntBuffer buf)
buf - ByteBuffer to usepublic void serializeTo64(IntBuffer buf)
buf - ByteBuffer to usepublic void serializeTo32(IntBuffer buf)
buf - ByteBuffer to usepublic boolean isZero()
public boolean equals(Object obj)
equals in class Objectpublic boolean equals(SignedInt128 o)
o - the object to compare
public int hashCode()
hashCode in class Objectpublic int compareTo(SignedInt128 o)
compareTo in interface Comparable<SignedInt128>public int intValue()
intValue in class Numberpublic long longValue()
longValue in class Numberpublic float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Number
public static void add(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
left - left operandright - right operandresult - object to receive the calculation resultpublic void addDestructive(SignedInt128 right)
right - right operand
public static void subtract(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
left - left operandright - right operandresult - object to receive the calculation resultpublic void subtractDestructive(SignedInt128 right)
right - right operand
public static void multiply(SignedInt128 left,
SignedInt128 right,
SignedInt128 result)
left - left operandright - right operandresult - object to receive the calculation resultpublic void multiplyDestructive(SignedInt128 right)
right - right operand. this object is not modified.public void multiplyDestructive(int right)
right - right operand.public int divideDestructive(int right)
right - the value to divide
public static void divide(SignedInt128 left,
SignedInt128 right,
SignedInt128 quotient,
SignedInt128 remainder)
left - left operandright - right operandquotient - result object to receive the calculation resultremainder - result object to receive the calculation result
public void divideDestructive(SignedInt128 right,
SignedInt128 remainder)
right - right operand. this object is not modified.remainder - result object to receive the calculation resultpublic void negateDestructive()
public void absDestructive()
public static void negate(SignedInt128 left,
SignedInt128 result)
left - left operandresult - object to receive the calculation result
public static void abs(SignedInt128 left,
SignedInt128 result)
left - left operandresult - object to receive the calculation resultpublic void incrementDestructive()
public void decrementDestructive()
public static void increment(SignedInt128 left,
SignedInt128 result)
left - left operandresult - object to receive the calculation result
public static void decrement(SignedInt128 left,
SignedInt128 result)
left - left operandresult - object to receive the calculation result
public void shiftRightDestructive(int bits,
boolean roundUp)
UnsignedInt128 for unsigned use.
bits - the number of bits. must be positiveroundUp - whether to round up the most significant bit that was discardedpublic void shiftLeftDestructive(int bits)
bits - the number of bits. must be positivepublic void scaleDownTenDestructive(short tenScale)
tenScale - scaling. must be positivepublic void scaleUpTenDestructive(short tenScale)
tenScale - scaling. must be positive
public static void shiftRight(SignedInt128 left,
SignedInt128 result,
int bits,
boolean roundUp)
left - left operandresult - object to receive the calculation resultbits - the number of bits. must be positiveroundUp - whether to round up the most significant bit that was discarded
public static void shiftLeft(SignedInt128 left,
SignedInt128 result,
int bits)
left - left operandresult - object to receive the calculation resultbits - the number of bits. must be positive
public static void scaleDownTen(SignedInt128 left,
SignedInt128 result,
short tenScale)
left - left operandresult - object to receive the calculation resulttenScale - scaling. must be positive
public static void scaleUpTen(SignedInt128 left,
SignedInt128 result,
short tenScale)
left - left operandresult - object to receive the calculation resulttenScale - scaling. must be positivepublic BigInteger toBigIntegerSlow()
BigInteger. Do not use this method in a
performance sensitive place.
public String toFormalString()
toString(), this method returns a string that
can be used to re-construct this object. Remember, toString() is only for
debugging.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||