Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.python.core.PyObject
org.python.core.PySequence
org.python.core.PySequenceList
org.python.core.PyList
public class PyList
extends PySequenceList
Nested Class Summary |
Nested classes/interfaces inherited from class org.python.core.PyObject | |
PyObject.ConversionException |
Field Summary | |
static Class | |
static String |
Fields inherited from class org.python.core.PyObject | |
exposed_name |
Method Summary | |
PyObject | |
PyTuple | |
PyObject | |
PyObject | |
int |
|
PyObject | |
PyObject |
|
void | |
static void |
|
int | |
void | |
int |
|
int | |
int | |
int | |
void | |
PyObject |
|
PyObject |
|
void | |
void |
|
String |
|
void |
|
void | |
String |
|
static void |
|
Methods inherited from class org.python.core.PySequenceList | |
add , add , addAll , addAll , clear , contains , containsAll , equals , get , getArray , hashCode , indexOf , isEmpty , iterator , lastIndexOf , listIterator , listIterator , pyadd , pyadd , pyget , pyset , remove , remove , remove , removeAll , retainAll , set , size , subList , toArray , toArray , toString |
Methods inherited from class org.python.core.PySequence | |
__delitem__ , __delslice__ , __eq__ , __finditem__ , __finditem__ , __ge__ , __getitem__ , __getslice__ , __gt__ , __iter__ , __le__ , __lt__ , __ne__ , __nonzero__ , __setitem__ , __setitem__ , __setslice__ , __tojava__ , isMappingType , isNumberType |
public static final Class exposed_base
public static final String exposed_name
public PyList()
This constructor is used by PyJavaClass.init()
public PyList(Vector v)
public PyList(PyObject[] elements)
Creates an instance directly backed by the array of PyObject elements.
- Parameters:
elements
-
public PyObject __add__(PyObject o)
Equivalent to the standard Python __add__ method
- Parameters:
- Returns:
- the result of the add, or null if this operation is not defined
public PyObject __iadd__(PyObject o)
Equivalent to the standard Python __iadd__ method
- Parameters:
- Returns:
- the result of the add, or null if this operation is not defined
public PyObject __imul__(PyObject o)
Equivalent to the standard Python __imul__ method
- Parameters:
- Returns:
- the result of the mul, or null if this operation is not defined
public int __len__()
Equivalent to the standard Python __len__ method. Part of the mapping discipline.
- Returns:
- the length of the object
public PyObject __radd__(PyObject o)
Equivalent to the standard Python __radd__ method
- Parameters:
- Returns:
- the result of the add, or null if this operation is not defined.
public PyObject __reduce__()
Used for pickling.
- Overrides:
- __reduce__ in interface PyObject
- Returns:
- a tuple of (class, tuple)
public void append(PyObject o)
Add a single element to the end of list.
- Parameters:
o
- the element to add.
public int count(PyObject o)
Return the number elements in the list that equals the argument.
- Parameters:
o
- the argument to test for. Testing is done with the==
operator.
public void extend(PyObject o)
Append the elements in the argument sequence to the end of the list.
Same ass[len(s):len(s)] = o
.
- Parameters:
o
- the sequence of items to append to the list.
public int index(PyObject o)
return smallest index where an element in the list equals the argument.
- Parameters:
o
- the argument to test for. Testing is done with the==
operator.
public void insert(int index, PyObject o)
Insert the argument element into the list at the specified index.
Same ass[index:index] = [o] if index >= 0
.
- Parameters:
index
- the position where the element will be inserted.o
- the element to insert.
public PyObject pop(int n)
Removes and return then
indexed element in the list.
- Parameters:
n
- the index of the element to remove and return.
public void remove(PyObject o)
Remove the first occurence of the argument from the list. The elements arecompared with the==
operator.
Same asdel s[s.index(x)]
- Parameters:
o
- the element to search for and remove.
public void reverse()
Reverses the items of s in place. The reverse() methods modify the list in place for economy of space when reversing a large list. It doesn't return the reversed list to remind you of this side effect.
public void sort()
Sort the items of the list in place. Items is compared with the normal relative comparison operators.
public void sort(PyObject compare)
Sort the items of the list in place. The compare argument is a function of two arguments (list items) which should return -1, 0 or 1 depending on whether the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much faster to use calls to the methods sort() and reverse() than to use the built-in function sort() with a comparison function that reverses the ordering of the elements.
- Parameters:
compare
- the comparison function.