Top Description Fields Constructors Methods
org.python.core.stringlib

public final Class IntArrayReverseBuilder

extends Reverse
Class Inheritance
Imports
java.util.Arrays

An elastic buffer of integer values, somewhat like the java.lang.StringBuilder, but for arrays of integers. The client prepends data, so the array builds right to left, and may finally take the built array, often without copying the data.

Field Summary

Modifier and TypeField and Description
private int
private int
private int[]

Constructor Summary

AccessConstructor and Description
public
IntArrayReverseBuilder(int
initially
capacity
)

Create an empty buffer of a defined initial capacity.

public
IntArrayReverseBuilder()

Create an empty buffer of a default initial capacity.

Method Summary

Modifier and TypeMethod and Description
protected void
ensure(int
to make additional space for
n
)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.ensure.

Ensure there is room for another n elements.
public int
length()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.length.

The number of elements currently
public int
max()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.max.

The maximum value stored.
protected void
prependUnchecked(int
to prepend
v
)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.Reverse.prependUnchecked.

Prepend one element without ensuring that there is space.
public int[]
take()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.take.

Provide the contents as an array and reset the builder to empty.
protected int[]
value()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.value.

An array of the elements in the buffer (not modified by methods on this object hereafter).
Inherited from org.python.core.stringlib.AbstractIntArrayBuilder.Reverse:
prependprependprepend

Field Detail

maxback to summary
private int max
ptrback to summary
private int ptr
valueback to summary
private int[] value

Constructor Detail

IntArrayReverseBuilderback to summary
public IntArrayReverseBuilder(int capacity)

Create an empty buffer of a defined initial capacity.

Parameters
capacity:int

initially

IntArrayReverseBuilderback to summary
public IntArrayReverseBuilder()

Create an empty buffer of a default initial capacity.

Method Detail

ensureback to summary
protected void ensure(int n)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.ensure.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.ensure.

Ensure there is room for another n elements. In general, this will mean allocating new storage (of a carefully-chosen size ≥ n+length()) and copying the existing contents to it.

Parameters
n:int

to make additional space for

Annotations
@Override
lengthback to summary
public int length()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.length.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.length.

The number of elements currently

Returns:int

the number of elements currently.

Annotations
@Override
maxback to summary
public int max()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.max.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.max.

The maximum value stored.

Returns:int

The maximum int stored.

Annotations
@Override
prependUncheckedback to summary
protected void prependUnchecked(int v)

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.Reverse.prependUnchecked.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.Reverse.prependUnchecked.

Prepend one element without ensuring that there is space. This method is for use when it is known that there is space for the element, for example, inside a loop before which when ensure(int) has been called.

Parameters
v:int

to prepend

Annotations
@Override
takeback to summary
public int[] take()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.take.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.take.

Provide the contents as an array and reset the builder to empty. (This is a "destructive read".) The return type is Object in order that sub-classes may define the specific type (for example, int[] or byte[]).

Returns:int[]

the contents as a Python str

Annotations
@Override
valueback to summary
protected int[] value()

Implements abstract org.python.core.stringlib.AbstractIntArrayBuilder.value.

Doc from org.python.core.stringlib.AbstractIntArrayBuilder.value.

An array of the elements in the buffer (not modified by methods on this object hereafter).

Returns:int[]

the elements in the buffer

Annotations
@Override