org.python.core
Class PyObjectArray
- Serializable
public class PyObjectArray
Provides mutable behavior on a PyObject array. Supports operations for
implementing java.util.List
.
void | add(int index, PyObject value) - Add a value at a specified index in the array.
|
int | add(PyObject value) - Add a value to the array, appending it after the current values.
|
Object | clone() - Duplicates the object with the generic call.
|
void | ensureCapacity(int minCapacity)
|
boolean | equals(Object o)
|
PyObject | get(int index) - Retrieve the value present at an index position in the array.
|
Object | getArray() - Get the backing array.
|
int | hashCode()
|
void | remove(int start, int stop)
|
PyObject | set(int index, PyObject value) - Set the value at an index position in the array.
|
PyObject[] | toArray() - Constructs and returns a simple array containing the same data as held
in this growable array.
|
appendArray , clear , copyArray , getModCountIncr , getSize , remove , remove , replaceSubArray , replaceSubArray , setSize , toString |
PyObjectArray
public PyObjectArray()
Create the array with the specified size.
PyObjectArray
public PyObjectArray(int size)
Create the array with the specified size.
size
- number of int values initially allowed in array
PyObjectArray
public PyObjectArray(PyObject[] rawArray)
add
public void add(int index,
PyObject value)
Add a value at a specified index in the array.
AbstractList
subclasses should update their
modCount
after calling this method.
index
- index position at which to insert elementvalue
- value to be inserted into array
add
public int add(PyObject value)
Add a value to the array, appending it after the current values.
AbstractList
subclasses should update their
modCount
after calling this method.
value
- value to be added
- index number of added element
clone
public Object clone()
Duplicates the object with the generic call.
ensureCapacity
public void ensureCapacity(int minCapacity)
equals
public boolean equals(Object o)
get
public PyObject get(int index)
Retrieve the value present at an index position in the array.
index
- index position for value to be retrieved
- value from position in the array
getArray
public Object getArray()
Get the backing array. This method is used by the type-agnostic base
class code to access the array used for type-specific storage. The array
should generally not be modified. To get a copy of the array, see
toArray()
which returns a copy. Note that
getSize()
should be used to determine the number of elements
in the array, not the array's length (which may reflect excess capacity).
toArray()
returns an array whose length equals the value
returned by
getSize()
.
hashCode
public int hashCode()
set
public PyObject set(int index,
PyObject value)
Set the value at an index position in the array.
index
- index position to be setvalue
- value to be set
toArray
public PyObject[] toArray()
Constructs and returns a simple array containing the same data as held
in this growable array. The array's length matches the value returned
by getSize()
- array containing a copy of the data
Jython homepage