📄 pyobject.java
字号:
} /** * Implements the Python expression <code>this < other</code>. * * @param other the object to compare this with. * @return the result of the comparison **/ public final PyObject _lt(PyObject o) { PyObject token = null; ThreadState ts = Py.getThreadState(); try { if (++ts.compareStateNesting > 10) { if ((token = check_recursion(ts, this, o)) == null) throw Py.ValueError("can't order recursive values"); } PyObject res = __lt__(o); if (res != null) return res; res = o.__gt__(this); if (res != null) return res; return _cmp_unsafe(o) < 0 ? Py.One : Py.Zero; } finally { delete_token(ts, token); ts.compareStateNesting--; } } /** * Implements the Python expression <code>this >= other</code>. * * @param other the object to compare this with. * @return the result of the comparison **/ public final PyObject _ge(PyObject o) { PyObject token = null; ThreadState ts = Py.getThreadState(); try { if (++ts.compareStateNesting > 10) { if ((token = check_recursion(ts, this, o)) == null) throw Py.ValueError("can't order recursive values"); } PyObject res = __ge__(o); if (res != null) return res; res = o.__le__(this); if (res != null) return res; return _cmp_unsafe(o) >= 0 ? Py.One : Py.Zero; } finally { delete_token(ts, token); ts.compareStateNesting--; } } /** * Implements the Python expression <code>this > other</code>. * * @param other the object to compare this with. * @return the result of the comparison **/ public final PyObject _gt(PyObject o) { PyObject token = null; ThreadState ts = Py.getThreadState(); try { if (++ts.compareStateNesting > 10) { if ((token = check_recursion(ts, this, o)) == null) throw Py.ValueError("can't order recursive values"); } PyObject res = __gt__(o); if (res != null) return res; res = o.__lt__(this); if (res != null) return res; return _cmp_unsafe(o) > 0 ? Py.One : Py.Zero; } finally { delete_token(ts, token); ts.compareStateNesting--; } } /** * Implements <code>is</code> operator. * * @param other the object to compare this with. * @return the result of the comparison **/ public PyObject _is(PyObject o) { return this == o ? Py.One : Py.Zero; } /** * Implements <code>is not</code> operator. * * @param other the object to compare this with. * @return the result of the comparison **/ public PyObject _isnot(PyObject o) { return this != o ? Py.One : Py.Zero; } /** * Implements <code>in</code> operator. * * @param other the container to search for this element. * @return the result of the search. **/ public final PyObject _in(PyObject o) { return Py.newBoolean(o.__contains__(this)); } /** * Implements <code>not in</code> operator. * * @param other the container to search for this element. * @return the result of the search. **/ public final PyObject _notin(PyObject o) { return Py.newBoolean(!o.__contains__(this)); } /** * Equivalent to the standard Python __contains__ method. * * @param o the element to search for in this container. * @return the result of the search. **/ public boolean __contains__(PyObject o) { PyObject iter = __iter__(); for (PyObject item = null; (item = iter.__iternext__()) != null; ) { if (o._eq(item).__nonzero__()) return true; } return false; } /** * Implements boolean not * * @return not this. **/ public PyObject __not__() { return __nonzero__() ? Py.Zero : Py.One; } /* The basic numeric operations */ /** * Equivalent to the standard Python __hex__ method * Should only be overridden by numeric objects that can be * reasonably represented as a hexadecimal string. * * @return a string representing this object as a hexadecimal number. **/ public PyString __hex__() { throw Py.AttributeError("__hex__"); } /** * Equivalent to the standard Python __oct__ method. * Should only be overridden by numeric objects that can be * reasonably represented as an octal string. * * @return a string representing this object as an octal number. **/ public PyString __oct__() { throw Py.AttributeError("__oct__"); } /** * Equivalent to the standard Python __int__ method. * Should only be overridden by numeric objects that can be * reasonably coerced into an integer. * * @return an integer corresponding to the value of this object. **/ public PyInteger __int__() { throw Py.AttributeError("__int__"); } /** * Equivalent to the standard Python __long__ method. * Should only be overridden by numeric objects that can be * reasonably coerced into a python long. * * @return a PyLong corresponding to the value of this object. **/ public PyLong __long__() { throw Py.AttributeError("__long__"); } /** * Equivalent to the standard Python __float__ method. * Should only be overridden by numeric objects that can be * reasonably coerced into a python float. * * @return a float corresponding to the value of this object. **/ public PyFloat __float__() { throw Py.AttributeError("__float__"); } /** * Equivalent to the standard Python __complex__ method. * Should only be overridden by numeric objects that can be * reasonably coerced into a python complex number. * * @return a complex number corresponding to the value of this object. **/ public PyComplex __complex__() { throw Py.AttributeError("__complex__"); } /** * Equivalent to the standard Python __pos__ method. * * @return +this. **/ public PyObject __pos__() { throw Py.AttributeError("__pos__"); } /** * Equivalent to the standard Python __neg__ method. * * @return -this. **/ public PyObject __neg__() { throw Py.AttributeError("__neg__"); } /** * Equivalent to the standard Python __abs__ method. * * @return abs(this). **/ public PyObject __abs__() { throw Py.AttributeError("__abs__"); } /** * Equivalent to the standard Python __invert__ method. * * @return ~this. **/ public PyObject __invert__() { throw Py.AttributeError("__invert__"); } /** * Implements the three argument power function. * * @param o2 the power to raise this number to. * @param o3 the modulus to perform this operation in or null if no * modulo is to be used * @return this object raised to the given power in the given modulus **/ public PyObject __pow__(PyObject o2, PyObject o3) { return null; } // Generated by make_binops.py (Begin) /** * Equivalent to the standard Python __add__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the add, or null if this operation * is not defined **/ public PyObject __add__(PyObject other) { return null; } /** * Equivalent to the standard Python __radd__ method * @param other the object to perform this binary operation with * (the left-hand operand). * @return the result of the add, or null if this operation * is not defined. **/ public PyObject __radd__(PyObject other) { return null; } /** * Equivalent to the standard Python __iadd__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the add, or null if this operation * is not defined **/ public PyObject __iadd__(PyObject other) { return _add(other); } /** * Implements the Python expression <code>this + other</code> * @param other the object to perform this binary operation with. * @return the result of the add. * @exception PyTypeError if this operation can't be performed * with these operands. **/ public final PyObject _add(PyObject o2) { PyObject x = __add__(o2); if (x != null) return x; x = o2.__radd__(this); if (x != null) return x; throw Py.TypeError( "__add__ nor __radd__ defined for these operands"); } /** * Equivalent to the standard Python __sub__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the sub, or null if this operation * is not defined **/ public PyObject __sub__(PyObject other) { return null; } /** * Equivalent to the standard Python __rsub__ method * @param other the object to perform this binary operation with * (the left-hand operand). * @return the result of the sub, or null if this operation * is not defined. **/ public PyObject __rsub__(PyObject other) { return null; } /** * Equivalent to the standard Python __isub__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the sub, or null if this operation * is not defined **/ public PyObject __isub__(PyObject other) { return _sub(other); } /** * Implements the Python expression <code>this - other</code> * @param other the object to perform this binary operation with. * @return the result of the sub. * @exception PyTypeError if this operation can't be performed * with these operands. **/ public final PyObject _sub(PyObject o2) { PyObject x = __sub__(o2); if (x != null) return x; x = o2.__rsub__(this); if (x != null) return x; throw Py.TypeError( "__sub__ nor __rsub__ defined for these operands"); } /** * Equivalent to the standard Python __mul__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the mul, or null if this operation * is not defined **/ public PyObject __mul__(PyObject other) { return null; } /** * Equivalent to the standard Python __rmul__ method * @param other the object to perform this binary operation with * (the left-hand operand). * @return the result of the mul, or null if this operation * is not defined. **/ public PyObject __rmul__(PyObject other) { return null; } /** * Equivalent to the standard Python __imul__ method * @param other the object to perform this binary operation with * (the right-hand operand). * @return the result of the mul, or null if this operation * is not defined **/ public PyObject __imul__(PyObject other) { return _mul(other); } /** * Implements the Python expression <code>this * other</code> * @param other the object to perform this binary operation with. * @return the result of the mul. * @exception PyTypeError if this operation can't be performed
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -