int object may be represented by a
java.lang.Integer or a java.math.BigInteger. An
instance of a Python sub-class of int, must be
represented by an instance of a Java sub-class of) this class.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | PyLong.Derived
Instances in Python of sub-classes of 'int', are represented in Java by instances of this class. |
| private static class | PyLong.Formatter
An |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final BigInteger | MAX_INT
The maximum Java |
| pack-priv static final BigInteger | MAX_LONG
The maximum Java |
| pack-priv static final BigInteger | MIN_INT
The minimum Java |
| pack-priv static final BigInteger | MIN_LONG
The minimum Java |
| private static final String | |
| private static final String | |
| public static final PyType | TYPE
The type |
| pack-priv final BigInteger | value
The value of this Python |
| Access | Constructor and Description |
|---|---|
| pack-priv | PyLong(PyType
actual Python sub-class being created subType, BigInteger of the v)intConstructor for Python sub-class specifying |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static final Object | |
| pack-priv static PyTuple | |
| pack-priv static Object | |
| private static Object | Returns: anint or sub-class with the right valueactual sub-type of int to produce subType, Object int-like or str-like value or
null.number base ( obase)x must be str-like)Implementation of |
| private static Object | |
| public Object | |
| pack-priv static Object | |
| pack-priv static BigInteger | Returns: BigInteger valueclaimed v)intPresent the value as a Java |
| pack-priv static double | |
| pack-priv static int | |
| public long | |
| pack-priv static int | |
| pack-priv static int | |
| pack-priv static Object | |
| pack-priv static BigInteger | Returns: converted toBigIntegerclaimed v)intConvert a Python |
| pack-priv static double | Returns: converted todoubleto convert v)Convert an |
| pack-priv static double | Returns: converted todoubleto convert v)Convert a |
| pack-priv static int | Returns: converted tointto convert v)Convert a Python |
| pack-priv static int | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Implements org. Key, define
this method so that calls from Java libraries to
Object.equals(Object) are answered with Python semantics.
|
| pack-priv static Object | |
| pack-priv static BigInteger | Returns: BigInteger equivalent.to convert value)Create a Python |
| pack-priv static Object | Returns: integer value of argumentto convert to integral)intConvert the given object to a |
| pack-priv static Object | |
| pack-priv static BigInteger | Returns: converted valuestring to convert u, int in which to interpret it base)Convert a sequence of Unicode digits in the string u to a Python integer value. |
| public static Object | |
| public static Object | |
| public long | |
| public long | |
| public static Object | |
| public static Object | |
| public BigInteger | |
| public int | hashCode()
Overrides java. Implements org. Key, define
this method so that calls from Java libraries to
Object.hashCode() receive the hash defined by Python.
|
| private static InterpreterError | Returns: exception to throwactual argument o)We received an argument that should be impossible in a correct interpreter. |
| private static Object | longSubtypeNew(PyType subType, Object x, Object obase)
Wimpy, slow approach to |
| pack-priv static int | |
| pack-priv static OverflowError | Returns: anOverflowError with that messagedescription of type to convert from from, String description of type to convert to to)Create an OverflowError with a message along the lines "X too
large to convert to Y", where X is |
| public String | toString()
Overrides org. |
| MAX_INT | back to summary |
|---|---|
| pack-priv static final BigInteger MAX_INT The maximum Java | |
| MAX_LONG | back to summary |
|---|---|
| pack-priv static final BigInteger MAX_LONG The maximum Java | |
| MIN_INT | back to summary |
|---|---|
| pack-priv static final BigInteger MIN_INT The minimum Java | |
| MIN_LONG | back to summary |
|---|---|
| pack-priv static final BigInteger MIN_LONG The minimum Java | |
| NON_STR_EXPLICIT_BASE | back to summary |
|---|---|
| private static final String NON_STR_EXPLICIT_BASE | |
| TOO_LARGE | back to summary |
|---|---|
| private static final String TOO_LARGE | |
| TYPE | back to summary |
|---|---|
| public static final PyType TYPE The type | |
| value | back to summary |
|---|---|
| pack-priv final BigInteger value The value of this Python | |
| PyLong | back to summary |
|---|---|
| pack-priv PyLong(PyType subType, BigInteger v) Constructor for Python sub-class specifying
| |
| __format__ | back to summary |
|---|---|
| pack-priv static final Object __format__(Object self, Object formatSpec) | |
| __getnewargs__ | back to summary |
|---|---|
| pack-priv static PyTuple __getnewargs__(Object self) | |
| __new__ | back to summary |
|---|---|
pack-priv static Object __new__(PyType subType, Object[] args, String[] kwnames) throws Throwable
| |
| __new__impl | back to summary |
|---|---|
| private static Object __new__impl(PyType subType, Object x, Object obase) throws Throwable Implementation of
an
| |
| __repr__ | back to summary |
|---|---|
private static Object __repr__(Object self)
| |
| __tojava__ | back to summary |
|---|---|
| public Object __tojava__(Class<?> c) | |
| __trunc__ | back to summary |
|---|---|
| pack-priv static Object __trunc__(Object self) | |
| asBigInteger | back to summary |
|---|---|
| pack-priv static BigInteger asBigInteger(Object v) throws TypeError Present the value as a Java
| |
| asDouble | back to summary |
|---|---|
| pack-priv static double asDouble(Object v) Value as a Java
| |
| asInt | back to summary |
|---|---|
| pack-priv static int asInt(Object v) throws TypeError, OverflowError Present the value as a Java
| |
| asLong | back to summary |
|---|---|
| public long asLong() | |
| asSize | back to summary |
|---|---|
| pack-priv static int asSize(Object v) throws TypeError, OverflowError Present the value as a Java
| |
| bit_length | back to summary |
|---|---|
| pack-priv static int bit_length(Object self) | |
| conjugate | back to summary |
|---|---|
| pack-priv static Object conjugate(Object self) | |
| convertToBigInteger | back to summary |
|---|---|
| pack-priv static BigInteger convertToBigInteger(Object v) throws NoConversion Convert a Python
If the method throws the special exception
| |
| convertToDouble | back to summary |
|---|---|
| pack-priv static double convertToDouble(Object v) throws NoConversion, OverflowError Convert an
If the method throws the special exception
| |
| convertToDouble | back to summary |
|---|---|
| pack-priv static double convertToDouble(BigInteger v) throws OverflowError Convert a
| |
| convertToInt | back to summary |
|---|---|
| pack-priv static int convertToInt(Object v) throws NoConversion, OverflowError Convert a Python
If the method throws the special exception
| |
| convertToInt | back to summary |
|---|---|
| pack-priv static int convertToInt(BigInteger v) throws OverflowError Convert a
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Implements org. Doc from org. Python objects that implement the interface
@Override
public int equals(Object obj) throws PyException {
return PyDict.pythonEquals(this, obj);
}
Objects that provide their own specialised implementation
of equals, receiving a Key a object as the
other argument, must dereference it with get()
and work on those contents. An idiom like this may be used:
@Override
public boolean equals(Object other) {
if (other instanceof PyDict.Key)
other = ((PyDict.Key) other).get();
// ... rest of implementation
}
| |
| from | back to summary |
|---|---|
| pack-priv static Object from(Object value) throws TypeError Return a Python | |
| fromDouble | back to summary |
|---|---|
| pack-priv static BigInteger fromDouble(double value) Create a Python
| |
| fromIndexOrIntOf | back to summary |
|---|---|
| pack-priv static Object fromIndexOrIntOf(Object integral) throws TypeError, Throwable Convert the given object to a
The return is not always exactly an | |
| fromIntOf | back to summary |
|---|---|
| pack-priv static Object fromIntOf(Object integral) throws TypeError, Throwable Convert the given object to a Python
The return is not always exactly an | |
| fromUnicode | back to summary |
|---|---|
| pack-priv static BigInteger fromUnicode(Object u, int base) throws ValueError, TypeError Convert a sequence of Unicode digits in the string u to a Python integer value.
converted value
| |
| getDenominator | back to summary |
|---|---|
| public static Object getDenominator(Object self) | |
| getImag | back to summary |
|---|---|
| public static Object getImag(Object self) | |
| getLong | back to summary |
|---|---|
| public long getLong(long min, long max) throws OverflowError | |
| getLong | back to summary |
|---|---|
| public long getLong(long min, long max, String overflowMsg) throws OverflowError | |
| getNumerator | back to summary |
|---|---|
| public static Object getNumerator(Object self) | |
| getReal | back to summary |
|---|---|
| public static Object getReal(Object self) | |
| getValue | back to summary |
|---|---|
| public BigInteger getValue() The value of this Python
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() throws PyException Overrides java. Implements org. Doc from org. Python objects that implement the interface
@Override
public int hashCode() throws PyException {
return PyDict.pythonHash(this);
}
Where it is known __hash__ cannot have been
redefined, object implementations may have a shorter option.
| |
| impossible | back to summary |
|---|---|
| private static InterpreterError impossible(Object o) We received an argument that should be impossible in a correct
interpreter. We use this when conversion of an
| |
| longSubtypeNew | back to summary |
|---|---|
| private static Object longSubtypeNew(PyType subType, Object x, Object obase) throws Throwable Wimpy, slow approach to
| |
| signum | back to summary |
|---|---|
| pack-priv static int signum(Object v) throws TypeError | |
| tooLarge | back to summary |
|---|---|
| pack-priv static OverflowError tooLarge(String from, String to) Create an OverflowError with a message along the lines "X too
large to convert to Y", where X is
an | |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Map | getDict()
Implements org. dict or
writable.
|
| Derived | back to summary |
|---|---|
| protected Derived(PyType subType, BigInteger value) | |
| getDict | back to summary |
|---|---|
| public Map Implements org. Doc from org. The dictionary of the instance, (not necessarily a Python | |
| Access | Constructor and Description |
|---|---|
| pack-priv | Formatter(InternalFormat.
a parsed PEP-3101 format specification. specPrepare an |
| Modifier and Type | Method and Description |
|---|---|
| public IntegerFormatter | format(Object
to format o)Implements abstract org. |
| private static InternalFormat. | Returns: validated spec with defaults filledto validate specValidations and defaults specific to |
| Formatter | back to summary |
|---|---|
| pack-priv Formatter(InternalFormat. Prepare an
| |
| format | back to summary |
|---|---|
| public IntegerFormatter format(Object o) throws NoConversion, FormatError Implements abstract org. Doc from org. Format an object into the buffer according to the specification with which this instance has been initialised. The specific behaviour, and the acceptable types, are for a sub-class to define. Also, it is usually desirable for the return type in an implementing class to be a more specific.
| |
| validated | back to summary |
|---|---|
| private static InternalFormat. Validations and defaults specific to
| |