|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
x10.lang.Int
public struct class Int
Int is a 32-bit signed two's complement integral data type, with values ranging from -2147483648 to 2147483647, inclusive. All of the normal arithmetic and bitwise operations are defined on Int, and Int is closed under those operations. There are also static methods that define conversions from other data types, including String, as well as some Int constants.
Field Summary | |
---|---|
static Int |
MIN_VALUE
Field Type: x10.lang.Int{self==-2147483648} A constant holding the minimum value an Int can have, -231. |
static Int |
MAX_VALUE
Field Type: x10.lang.Int{self==2147483647} A constant holding the maximum value an Int can have, 231-1. |
Constructor Summary | |
---|---|
Int()
|
Method Summary | |
---|---|
Boolean |
operator<(Int x)
A less-than operator. |
Boolean |
operator>(Int x)
A greater-than operator. |
Boolean |
operator<=(Int x)
A less-than-or-equal-to operator. |
Boolean |
operator>=(Int x)
A greater-than-or-equal-to operator. |
Int |
operator+(Int x)
A binary plus operator. |
Int |
operator-(Int x)
A binary minus operator. |
Int |
operator*(Int x)
A binary multiply operator. |
Int |
operator/(Int x)
A binary divide operator. |
Int |
operator%(Int x)
A binary remainder operator. |
Int |
operator+()
A unary plus operator. |
Int |
operator-()
A unary minus operator. |
Int |
operator&(Int x)
A bitwise and operator. |
Int |
operator|(Int x)
A bitwise or operator. |
Int |
operator^(Int x)
A bitwise xor operator. |
Int |
operator<<(Int count)
A bitwise left shift operator. |
Int |
operator>>(Int count)
A bitwise right shift operator. |
Int |
operator>>>(Int count)
Deprecated. use the right-shift operator and unsigned conversions instead. |
Int |
operator~()
A bitwise complement operator. |
static Int |
implicit_operator_as(Byte x)
Coerce a given Byte to an Int. |
static Int |
implicit_operator_as(Short x)
Coerce a given Short to an Int. |
static Int |
operator_as(Long x)
Convert a given Long to an Int. |
static Int |
operator_as(Float x)
Convert a given Float to an Int. |
static Int |
operator_as(Double x)
Convert a given Double to an Int. |
static Int |
operator_as(UInt x)
Coerce a given UInt to an Int. |
String |
toString(Int radix)
Returns a String representation of this Int in the specified radix. |
String |
toHexString()
Returns a String representation of this Int as a hexadecimal number. |
String |
toOctalString()
Returns a String representation of this Int as an octal number. |
String |
toBinaryString()
Returns a String representation of this Int as a binary number. |
String |
toString()
Returns a String representation of this Int as a decimal number. |
static Int |
parseInt(String s,
Int radix)
Deprecated. use parse(String,Int) instead |
static Int |
parseInt(String s)
Deprecated. use parse(String) instead |
static Int |
parse(String s,
Int radix)
Parses the String argument as an Int in the radix specified by the second argument. |
static Int |
parse(String s)
Parses the String argument as a decimal Int. |
Int |
highestOneBit()
Returns an Int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in this Int value. |
Int |
lowestOneBit()
Returns an Int value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit in this Int value. |
Int |
numberOfLeadingZeros()
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of this Int. |
Int |
numberOfTrailingZeros()
Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of this Int. |
Int |
bitCount()
Returns the number of one-bits in the two's complement binary representation of this Int. |
Int |
rotateLeft(Int distance)
Returns the value obtained by rotating the two's complement binary representation of this Int left by the specified number of bits. |
Int |
rotateRight(Int distance)
Returns the value obtained by rotating the two's complement binary representation of this Int right by the specified number of bits. |
Int |
reverse()
Returns the value obtained by reversing the order of the bits in the two's complement binary representation of this Int. |
Int |
signum()
Returns the signum function of this Int. |
Int |
reverseBytes()
Returns the value obtained by reversing the order of the bytes in the two's complement representation of this Int. |
Boolean |
equals(Any x)
Return true if the given entity is an Int, and this Int is equal to the given entity. |
Boolean |
equals(Int x)
Returns true if this Int is equal to the given Int. |
Int |
compareTo(Int x)
Returns a negative Int, zero, or a positive Int if this Int is less than, equal to, or greater than the given Int. |
static IntRange |
operator..(Int x,
Int y)
Declaration: operator..(x:x10.lang.Int,y:x10.lang.Int): x10.lang.IntRange{self.min==x, self.max==y}. Constructs a IntRange from the lower bound to the upper bound, inclusive. |
String |
typeName()
|
Boolean |
_struct_equals(Any other)
|
Boolean |
_struct_equals(Int other)
|
Int |
x10$lang$Int$$x10$lang$Int$this()
Declaration: x10$lang$Int$$x10$lang$Int$this(): x10.lang.Int{self==this(:x10.lang.Int)}. Int is a 32-bit signed two's complement integral data type, with values ranging from -2147483648 to 2147483647, inclusive. |
Methods inherited from interface x10.lang.Comparable |
---|
compareTo |
Methods inherited from interface x10.lang.Arithmetic |
---|
operator+, operator-, operator+, operator-, operator*, operator/ |
Methods inherited from interface x10.lang.Bitwise |
---|
operator~, operator&, operator|, operator^, operator<<, operator>>, operator>>> |
Methods inherited from interface x10.util.Ordered |
---|
operator<, operator>, operator<=, operator>= |
Methods inherited from interface x10.lang.Any |
---|
toString, typeName, equals, hashCode |
Field Detail |
---|
public static final Int MIN_VALUE
A constant holding the minimum value an Int can have, -231.
public static final Int MAX_VALUE
A constant holding the maximum value an Int can have, 231-1.
Constructor Detail |
---|
public Int()
Method Detail |
---|
public final Boolean operator<(Int x)
x
- the other Int
public final Boolean operator>(Int x)
x
- the other Int
public final Boolean operator<=(Int x)
x
- the other Int
public final Boolean operator>=(Int x)
x
- the other Int
public final Int operator+(Int x)
x
- the other Int
public final Int operator-(Int x)
x
- the other Int
public final Int operator*(Int x)
x
- the other Int
public final Int operator/(Int x)
x
- the other Int
public final Int operator%(Int x)
x
- the other Int
public final Int operator+()
public final Int operator-()
public final Int operator&(Int x)
x
- the other Int
public final Int operator|(Int x)
x
- the other Int
public final Int operator^(Int x)
x
- the other Int
public final Int operator<<(Int count)
count
- the shift count
public final Int operator>>(Int count)
count
- the shift count
public final Int operator>>>(Int count)
count
- the shift count
public final Int operator~()
public static final Int implicit_operator_as(Byte x)
x
- the given Byte
public static final Int implicit_operator_as(Short x)
x
- the given Short
public static final Int operator_as(Long x)
x
- the given Long
public static final Int operator_as(Float x)
x
- the given Float
public static final Int operator_as(Double x)
x
- the given Double
public static final Int operator_as(UInt x)
x
- the given UInt
public final String toString(Int radix)
radix
- the radix to use in the String representation
public final String toHexString()
public final String toOctalString()
public final String toBinaryString()
public final String toString()
public static final Int parseInt(String s, Int radix)
parse(String,Int)
instead
public static final Int parseInt(String s)
parse(String)
instead
public static final Int parse(String s, Int radix)
s
- the String containing the Int representation to be parsedradix
- the radix to be used while parsing s
NumberFormatException
- if the String does not contain a parsable Int.public static final Int parse(String s)
s
- the String containing the Int representation to be parsed
NumberFormatException
- if the String does not contain a parsable Int.public final Int highestOneBit()
public final Int lowestOneBit()
public final Int numberOfLeadingZeros()
public final Int numberOfTrailingZeros()
public final Int bitCount()
public final Int rotateLeft(Int distance)
rotateLeft(val, -distance) == rotateRight(val, distance)
.
Note also that rotation by any multiple of 32 is a no-op, so all but
the last five bits of the rotation distance can be ignored, even if
the distance is negative:
rotateLeft(val, distance) == rotateLeft(val, distance & 0x1F)
.
distance
- the distance to rotate by
rotateRight(Int)
public final Int rotateRight(Int distance)
rotateRight(val, -distance) == rotateLeft(val, distance)
.
Note also that rotation by any multiple of 32 is a no-op, so all but
the last five bits of the rotation distance can be ignored, even if
the distance is negative:
rotateRight(val, distance) == rotateRight(val, distance & 0x1F)
.
distance
- the distance to rotate by
rotateLeft(Int)
public final Int reverse()
public final Int signum()
public final Int reverseBytes()
public final Boolean equals(Any x)
x
- the given entity
public final Boolean equals(Int x)
x
- the given Int
public final Int compareTo(Int x)
x
- the given Int
public static final IntRange operator..(Int x, Int y)
Constructs a IntRange from the lower bound to the upper bound, inclusive.
lower
- the lower boundupper
- the upper bound
public final String typeName()
public final Boolean _struct_equals(Any other)
public final Boolean _struct_equals(Int other)
public final Int x10$lang$Int$$x10$lang$Int$this()
Int is a 32-bit signed two's complement integral data type, with values ranging from -2147483648 to 2147483647, inclusive. All of the normal arithmetic and bitwise operations are defined on Int, and Int is closed under those operations. There are also static methods that define conversions from other data types, including String, as well as some Int constants.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |