|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.python.core.PyObject
org.python.core.PySequence
public abstract class 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 subclasses of PySequence to implement java.util.List. 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/interfaces inherited from class org.python.core.PyObject |
|---|
PyObject.ConversionException |
| Field Summary | |
|---|---|
int |
gListAllocatedStatus
|
| Fields inherited from class org.python.core.PyObject |
|---|
TYPE |
| 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 start,
PyObject stop,
PyObject 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 start,
PyObject stop,
PyObject 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 start,
PyObject stop,
PyObject step,
PyObject value)
|
java.lang.Object |
__tojava__(java.lang.Class c)
Equivalent to the Jython __tojava__ method. |
boolean |
isMappingType()
|
boolean |
isNumberType()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int gListAllocatedStatus
| Constructor Detail |
|---|
public PySequence()
| Method Detail |
|---|
public boolean __nonzero__()
PyObjectPyObject is considered true.
__nonzero__ in class PyObjectpublic PyObject __iter__()
PyObjectIf 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:
for (PyObject item : seq.asIterable()) {
// Do somting with item
}
__iter__ in class PyObjectpublic PyObject __eq__(PyObject o)
PyObject
__eq__ in class PyObjecto - the object to compare this with.
public PyObject __ne__(PyObject o)
PyObject
__ne__ in class PyObjecto - the object to compare this with.
public PyObject __lt__(PyObject o)
PyObject
__lt__ in class PyObjecto - the object to compare this with.
public PyObject __le__(PyObject o)
PyObject
__le__ in class PyObjecto - the object to compare this with.
public PyObject __gt__(PyObject o)
PyObject
__gt__ in class PyObjecto - the object to compare this with.
public PyObject __ge__(PyObject o)
PyObject
__ge__ in class PyObjecto - the object to compare this with.
public PyObject __finditem__(int index)
PyObjectint 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 PyObjectindex - the key to lookup in this sequence.
PyObject.__finditem__(PyObject)public PyObject __finditem__(PyObject index)
PyObject
__finditem__ in class PyObjectindex - the key to lookup in this container
public PyObject __getitem__(PyObject index)
PyObject__finditem__ method instead.
__getitem__ in class PyObjectindex - the key to lookup in this container.
PyObject.__finditem__(PyObject)
public boolean isMappingType()
throws PyIgnoreMethodTag
isMappingType in class PyObjectPyIgnoreMethodTag
public boolean isNumberType()
throws PyIgnoreMethodTag
isNumberType in class PyObjectPyIgnoreMethodTag
public PyObject __getslice__(PyObject start,
PyObject stop,
PyObject step)
__getslice__ in class PyObject
public void __setslice__(PyObject start,
PyObject stop,
PyObject step,
PyObject value)
__setslice__ in class PyObject
public void __delslice__(PyObject start,
PyObject stop,
PyObject step)
__delslice__ in class PyObject
public void __setitem__(int index,
PyObject value)
PyObjectint 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 PyObjectindex - 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 PyObjectindex - the key whose value will be setvalue - the value to set this key topublic void __delitem__(PyObject index)
PyObject
__delitem__ in class PyObjectindex - the key to be removed from the container
public java.lang.Object __tojava__(java.lang.Class c)
throws PyIgnoreMethodTag
PyObjectPy.NoConversion
if this PyObject can not be converted to the
desired Java class.
__tojava__ in class PyObjectc - the Class to convert this PyObject to.
PyIgnoreMethodTag
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||