|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.python.core.PyObject org.python.core.PySequence
The abstract superclass of PyObjects that implements a Sequence. Minimize the work in creating such objects. Method names are designed to make it possible for PySequence to implement java.util.List interface when JDK 1.2 is ubiquitous. All subclasses must declare that they implement the ClassDictInit interface, and provide an classDictInit() method that calls PySequence.classDictInit(). Subclasses must also implement get, getslice, and repeat methods. Subclasses that are mutable should also implement: set, setslice, del, and delRange.
Nested Class Summary |
Nested classes inherited from class org.python.core.PyObject |
PyObject.ConversionException |
Field Summary |
Fields inherited from class org.python.core.PyObject |
exposed_name |
Constructor Summary | |
PySequence()
This constructor is used by PyJavaClass.init() |
Method Summary | |
void |
__delitem__(PyObject index)
Equivalent to the standard Python __delitem__ method. |
void |
__delslice__(PyObject s_start,
PyObject s_stop,
PyObject s_step)
|
PyObject |
__eq__(PyObject o)
Equivalent to the standard Python __eq__ method. |
PyObject |
__finditem__(int index)
A variant of the __finditem__ method which accepts a primitive int as the key. |
PyObject |
__finditem__(PyObject index)
Very similar to the standard Python __getitem__ method. |
PyObject |
__ge__(PyObject o)
Equivalent to the standard Python __ge__ method. |
PyObject |
__getitem__(PyObject index)
Equivalent to the standard Python __getitem__ method. |
PyObject |
__getslice__(PyObject s_start,
PyObject s_stop,
PyObject s_step)
|
PyObject |
__gt__(PyObject o)
Equivalent to the standard Python __gt__ method. |
PyObject |
__iter__()
Return an iterator that is used to iterate the element of this sequence. |
PyObject |
__le__(PyObject o)
Equivalent to the standard Python __le__ method. |
PyObject |
__lt__(PyObject o)
Equivalent to the standard Python __lt__ method. |
PyObject |
__ne__(PyObject o)
Equivalent to the standard Python __ne__ method. |
boolean |
__nonzero__()
Equivalent to the standard Python __nonzero__ method. |
void |
__setitem__(int index,
PyObject value)
A variant of the __setitem__ method which accepts a primitive int as the key.
|
void |
__setitem__(PyObject index,
PyObject value)
Equivalent to the standard Python __setitem__ method. |
void |
__setslice__(PyObject s_start,
PyObject s_stop,
PyObject s_step,
PyObject value)
|
java.lang.Object |
__tojava__(java.lang.Class c)
Equivalent to the Jython __tojava__ method. |
static void |
classDictInit(PyObject dict)
Internal use only. |
boolean |
isMappingType()
|
boolean |
isNumberType()
|
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PySequence()
Method Detail |
public static void classDictInit(PyObject dict) throws PyIgnoreMethodTag
PyIgnoreMethodTag
public boolean __nonzero__()
PyObject
PyObject
is
considered true.
__nonzero__
in class PyObject
public PyObject __iter__()
PyObject
If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:
public PyObject __iter__() { return new PySequenceIter(this); }When iterating over a python sequence from java code, it should be done with code like this:
PyObject iter = seq.__iter__(); for (PyObject item; (item = iter.__next__()) != null; { // Do somting with item }
__iter__
in class PyObject
public PyObject __eq__(PyObject o)
PyObject
__eq__
in class PyObject
o
- the object to compare this with.
public PyObject __ne__(PyObject o)
PyObject
__ne__
in class PyObject
o
- the object to compare this with.
public PyObject __lt__(PyObject o)
PyObject
__lt__
in class PyObject
o
- the object to compare this with.
public PyObject __le__(PyObject o)
PyObject
__le__
in class PyObject
o
- the object to compare this with.
public PyObject __gt__(PyObject o)
PyObject
__gt__
in class PyObject
o
- the object to compare this with.
public PyObject __ge__(PyObject o)
PyObject
__ge__
in class PyObject
o
- the object to compare this with.
public PyObject __finditem__(int index)
PyObject
int
as the key. By default, this method will call
__finditem__(PyObject key)
with the appropriate args.
The only reason to override this method is for performance.
__finditem__
in class PyObject
index
- the key to lookup in this sequence.
PyObject.__finditem__(PyObject)
public PyObject __finditem__(PyObject index)
PyObject
__finditem__
in class PyObject
index
- the key to lookup in this container
public PyObject __getitem__(PyObject index)
PyObject
__finditem__
method instead.
__getitem__
in class PyObject
index
- the key to lookup in this container.
PyObject.__finditem__(PyObject)
public boolean isMappingType() throws PyIgnoreMethodTag
isMappingType
in class PyObject
PyIgnoreMethodTag
public boolean isNumberType() throws PyIgnoreMethodTag
isNumberType
in class PyObject
PyIgnoreMethodTag
public PyObject __getslice__(PyObject s_start, PyObject s_stop, PyObject s_step)
__getslice__
in class PyObject
public void __setslice__(PyObject s_start, PyObject s_stop, PyObject s_step, PyObject value)
__setslice__
in class PyObject
public void __delslice__(PyObject s_start, PyObject s_stop, PyObject s_step)
__delslice__
in class PyObject
public void __setitem__(int index, PyObject value)
PyObject
int
as the key.
By default, this will call
__setitem__(PyObject key, PyObject value)
with the appropriate args.
The only reason to override this method is for performance.
__setitem__
in class PyObject
index
- the key whose value will be setvalue
- the value to set this key toPyObject.__setitem__(PyObject, PyObject)
public void __setitem__(PyObject index, PyObject value)
PyObject
__setitem__
in class PyObject
index
- the key whose value will be setvalue
- the value to set this key topublic void __delitem__(PyObject index)
PyObject
__delitem__
in class PyObject
index
- the key to be removed from the containerpublic java.lang.Object __tojava__(java.lang.Class c) throws PyIgnoreMethodTag
PyObject
Py.NoConversion
if this PyObject
can not be converted to the
desired Java class.
__tojava__
in class PyObject
c
- the Class to convert this PyObject
to.
PyIgnoreMethodTag
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |