Package org.python.core
Class PyObjectArray
java.lang.Object
org.python.core.AbstractArray
org.python.core.PyObjectArray
- All Implemented Interfaces:
Serializable
Provides mutable behavior on a PyObject array. Supports operations for
implementing
java.util.List.- Author:
- Clark Updike
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate the array with the specified size.PyObjectArray(int size) Create the array with the specified size.PyObjectArray(PyObject[] rawArray) PyObjectArray(PyObjectArray toCopy) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a value at a specified index in the array.intAdd a value to the array, appending it after the current values.clone()Duplicates the object with the generic call.voidensureCapacity(int minCapacity) booleanget(int index) Retrieve the value present at an index position in the array.getArray()Get the backing array.inthashCode()voidremove(int start, int stop) Removes a range from the array at the specified indices.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.Methods inherited from class org.python.core.AbstractArray
appendArray, clear, copyArray, getModCountIncr, getSize, remove, replaceSubArray, replaceSubArray, setSize, toString
-
Constructor Details
-
PyObjectArray
public PyObjectArray()Create the array with the specified size. -
PyObjectArray
-
PyObjectArray
public PyObjectArray(int size) Create the array with the specified size.- Parameters:
size- number of int values initially allowed in array
-
PyObjectArray
- Parameters:
toCopy-
-
-
Method Details
-
remove
public void remove(int start, int stop) Description copied from class:AbstractArrayRemoves a range from the array at the specified indices.- Overrides:
removein classAbstractArray- Parameters:
start- inclusivestop- exclusive
-
add
Add a value at a specified index in the array.AbstractListsubclasses should update theirmodCountafter calling this method.- Parameters:
index- index position at which to insert elementvalue- value to be inserted into array
-
add
Add a value to the array, appending it after the current values.AbstractListsubclasses should update theirmodCountafter calling this method.- Parameters:
value- value to be added- Returns:
- index number of added element
-
clone
Duplicates the object with the generic call.- Returns:
- a copy of the object
-
equals
-
hashCode
public int hashCode() -
get
Retrieve the value present at an index position in the array.- Parameters:
index- index position for value to be retrieved- Returns:
- value from position in the array
-
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, seetoArray()which returns a copy. Note thatgetSize()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 bygetSize().- Returns:
- backing array object
-
set
Set the value at an index position in the array.- Parameters:
index- index position to be setvalue- value to be set
-
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 bygetSize()- Returns:
- array containing a copy of the data
-
ensureCapacity
public void ensureCapacity(int minCapacity)
-