Top Description Fields Constructors Methods
org.python.core

public Class PyInteger

extends PyObject
Class Inheritance
Known Direct Subclasses
org.python.core.PyIntegerDerived, com.ziclix.python.sql.DBApiType, org.python.core.PyBoolean
Annotations
@Untraversable
@ExposedType
name:int
doc:int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If base is zero, the proper base is guessed based on the string content. If the argument is outside the integer range a long object will be returned instead.
Imports
java.io.Serializable, java.math.BigInteger, org.python.core.stringlib.FloatFormatter, .IntegerFormatter, .InternalFormat, .InternalFormat.Formatter, .InternalFormat.Spec, org.python.expose.ExposedGet, .ExposedMethod, .ExposedNew, .ExposedType, .MethodType

A builtin python int.

Field Summary

Modifier and TypeField and Description
private static final String
public static final BigInteger
MAX_INT

The maximum value of an int represented by a BigInteger

public static final BigInteger
maxInt

Deprecated Use MAX_INT instead.
public static final BigInteger
MIN_INT

The minimum value of an int represented by a BigInteger

public static final BigInteger
minInt

Deprecated Use MIN_INT instead.
public static final PyType
private final int
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
PyInteger(PyType subType, int v)

public
PyInteger(int v)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__abs__()

Overrides org.python.core.PyObject.__abs__.

Equivalent to the standard Python __abs__ method.

public PyObject
__add__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__add__.

Equivalent to the standard Python __add__ method.

public PyObject
__and__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__and__.

Equivalent to the standard Python __and__ method

public int
__cmp__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__cmp__.

Equivalent to the standard Python __cmp__ method.

public Object
__coerce_ex__(PyObject
the other object involved in the coercion
other
)

Overrides org.python.core.PyObject.__coerce_ex__.

Implements numeric coercion

public PyComplex
__complex__()

Overrides org.python.core.PyObject.__complex__.

Equivalent to the standard Python __complex__ method.

public PyObject
__div__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__div__.

Equivalent to the standard Python __div__ method

public PyObject
__divmod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__divmod__.

Equivalent to the standard Python __divmod__ method

public PyFloat
__float__()

Overrides org.python.core.PyObject.__float__.

Equivalent to the standard Python __float__ method.

public PyObject
__floordiv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__floordiv__.

Equivalent to the standard Python __floordiv__ method

public PyObject
public PyTuple
public PyString
__hex__()

Overrides org.python.core.PyObject.__hex__.

Equivalent to the standard Python __hex__ method Should only be overridden by numeric objects that can be reasonably represented as a hexadecimal string.

public PyObject
__index__()

Overrides org.python.core.PyObject.__index__.

Equivalent to the standard Python __index__ method.

public PyObject
__int__()

Overrides org.python.core.PyObject.__int__.

Equivalent to the standard Python __int__ method.

public PyObject
__invert__()

Overrides org.python.core.PyObject.__invert__.

Equivalent to the standard Python __invert__ method.

public PyObject
__long__()

Overrides org.python.core.PyObject.__long__.

Equivalent to the standard Python __long__ method.

public PyObject
__lshift__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__lshift__.

Equivalent to the standard Python __lshift__ method

public PyObject
__mod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mod__.

Equivalent to the standard Python __mod__ method

public PyObject
__mul__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mul__.

Equivalent to the standard Python __mul__ method.

public PyObject
__neg__()

Overrides org.python.core.PyObject.__neg__.

Equivalent to the standard Python __neg__ method.

public boolean
__nonzero__()

Overrides org.python.core.PyObject.__nonzero__.

Equivalent to the standard Python __nonzero__ method.

public PyString
__oct__()

Overrides org.python.core.PyObject.__oct__.

Equivalent to the standard Python __oct__ method.

public PyObject
__or__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__or__.

Equivalent to the standard Python __or__ method

public PyObject
__pos__()

Overrides org.python.core.PyObject.__pos__.

Equivalent to the standard Python __pos__ method.

public PyObject
__pow__(PyObject
the power to raise this number to.
right
,
PyObject
the modulus to perform this operation in or null if no modulo is to be used
modulo
)

Overrides org.python.core.PyObject.__pow__.

Implements the three argument power function.

public PyObject
__radd__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__radd__.

Equivalent to the standard Python __radd__ method.

public PyObject
__rdiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rdiv__.

Equivalent to the standard Python __rdiv__ method

public PyObject
__rfloordiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rfloordiv__.

Equivalent to the standard Python __rfloordiv__ method

public PyObject
__rmod__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmod__.

Equivalent to the standard Python __rmod__ method

public PyObject
__rmul__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmul__.

Equivalent to the standard Python __rmul__ method.

public PyObject
__rpow__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rpow__.

Equivalent to the standard Python __rpow__ method

public PyObject
__rshift__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__rshift__.

Equivalent to the standard Python __rshift__ method

public PyObject
__rsub__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rsub__.

Equivalent to the standard Python __rsub__ method

public PyObject
__rtruediv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rtruediv__.

Equivalent to the standard Python __rtruediv__ method

public PyObject
__sub__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__sub__.

Equivalent to the standard Python __sub__ method

public Object
__tojava__(Class<?>
the Class to convert this PyObject to.
c
)

Overrides org.python.core.PyObject.__tojava__.

Equivalent to the Jython __tojava__ method.

public PyObject
__truediv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__truediv__.

Equivalent to the standard Python __truediv__ method

public PyObject
__trunc__()

Overrides org.python.core.PyObject.__trunc__.

Equivalent to the standard Python __trunc__ method.

public PyObject
__xor__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__xor__.

Equivalent to the standard Python __xor__ method

private static PyObject
_pow(int value, int pow, PyObject modulo, PyObject left, PyObject right)

private static PyObject
_sub(int a, int b)

public int
asIndex(PyObject
the Python exception to raise on OverflowErrors
err
)

Overrides org.python.core.PyObject.asIndex.

Convert this object into an index-sized integer.

public int
public int
asInt()

Overrides org.python.core.PyObject.asInt.

Convert this object into an int.

public long
public long
asLong()

Overrides org.python.core.PyObject.asLong.

Convert this object into a long.

private static PyObject

Returns:

int or long result.
asPyInteger
(PyObject
to convert to an int
x
)

Convert all sorts of object types to either PyInteger or PyLong, using their PyObject#__int__() method, whether exposed or not, or if that raises an exception (as the base PyObject one does), using any __trunc__() the type may have exposed.

public int
bit_length()

Overrides org.python.core.PyObject.bit_length.

Equivalent to the standard Python bit_length method.

private static final boolean
private static final int
public PyObject
conjugate()

Overrides org.python.core.PyObject.conjugate.

Equivalent to the standard Python conjugate method.

private static PyObject

Returns:

convert to an int.
convertIntegralToInt
(PyObject integral)

Helper called on whatever exposed method __trunc__ returned: it may be int, long or something with an exposed __int__.

private static long
divide(long x, long y)

private PyString

Returns:

converted value of this object
formatImpl
(InternalFormat.Spec
prepared format-specifier.
spec
)

Common code used by the number-base conversion method __oct__ and __hex__.

public PyObject
public PyObject
public PyObject
public PyObject
public int
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final Object
int___coerce_ex__(PyObject other)

Coercion logic for int.

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyFloat
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyTuple
pack-priv final PyString
pack-priv final PyObject
pack-priv final PyInteger
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final boolean
pack-priv final PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
int___pow__(PyObject right, PyObject modulo)

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final int
public static PyObject
int_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

pack-priv final String
public boolean
isIndex()

Overrides org.python.core.PyObject.isIndex.

Determine if this object can act as an index (implements __index__).

public boolean
public boolean
public boolean
private static long
modulo(long x, long y, long xdivy)

pack-priv static IntegerFormatter

Returns:

a formatter ready to use, or null if the type is not an integer format type.
prepareFormatter
(InternalFormat.Spec
a parsed PEP-3101 format specification.
spec
)

Common code for PyInteger and PyLong to prepare an IntegerFormatter.

public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

Inherited from org.python.core.PyObject:
__call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____coerce____contains____delattr____delattr____delete____delitem____delitem____delslice____delslice____dir____ensure_finalizer____eq____findattr____findattr____findattr_ex____finditem____finditem____finditem____ge____get____getattr____getattr____getitem____getitem____getslice____getslice____gt____hash____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____le____len____lt____ne____not____pow____rand____rawdir____rdivmod____reduce____reduce_ex____reduce_ex____repr____rlshift____ror____rrshift____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____str____unicode___add_and_basic_add_basic_and_basic_div_basic_divmod_basic_floordiv_basic_iadd_basic_iand_basic_idiv_basic_idivmod_basic_ifloordiv_basic_ilshift_basic_imod_basic_imul_basic_ior_basic_ipow_basic_irshift_basic_isub_basic_itruediv_basic_ixor_basic_lshift_basic_mod_basic_mul_basic_or_basic_pow_basic_rshift_basic_sub_basic_truediv_basic_xor_callextra_cmp_coerce_div_divmod_doget_doget_doset_eq_floordiv_ge_gt_iadd_iand_idiv_idivmod_ifloordiv_ilshift_imod_imul_in_ior_ipow_irshift_is_isnot_isub_itruediv_ixor_jcall_jcallexc_jthrow_le_lshift_lt_mod_mul_ne_notin_or_pow_rshift_sub_truediv_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIterableasNameasNameasStringasStringasStringOrNullasStringOrNulldelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIntegerjdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___contains__object___delattr__object___delattr__object___findattr__object___format__object___getattribute__object___hash__object___init__object___new__object___reduce__object___reduce_ex__object___setattr__object___setattr__object___subclasshook__object_toStringproxyInitreadonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage