|
AlgART Home | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.algart.arrays.AbstractArray
net.algart.arrays.AbstractIntArray
public abstract class AbstractIntArray extends AbstractArray implements IntArray
Implementation of almost all basic functions of IntArray interface.
The only IntArray.getInt(long) method is not defined in this class;
all other methods are implemented via calls of IntArray.getInt(long).
AlgART Laboratory 2007-2013
| Modifier and Type | Field and Description |
|---|
| Fields inherited from class net.algart.arrays.AbstractArray |
|---|
capacity, length, underlyingArrays |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractIntArray(long initialCapacityAndLength,
boolean underlyingArraysAreParallel,
Array... underlyingArrays)
Equivalent to the constructor AbstractIntArray(long, long, boolean, Array...),
where both initialCapacity and initialLength arguments are equal to
initialCapacityAndLength. |
protected |
AbstractIntArray(long initialCapacity,
long initialLength,
boolean underlyingArraysAreParallel,
Array... underlyingArrays)
Creates an array with the given initial capacity and length. |
| Modifier and Type | Method and Description |
|---|---|
Array |
asCopyOnNextWrite()
This implementation returns this object. |
IntArray |
asImmutable()
This implementation returns this object. |
IntArray |
asTrustedImmutable()
This implementation calls asImmutable() and returns its result. |
long |
bitsPerElement()
Return the number of memory bits occupied by every element of this array. |
DataIntBuffer |
buffer()
This implementation returns buffer(suitableMode), where suitableMode is
this instanceof UpdatableArray ?
DataBuffer.AccessMode.READ_WRITE :
DataBuffer.AccessMode.READ. |
DataIntBuffer |
buffer(DataBuffer.AccessMode mode)
This implementation returns buffer(mode, someCapacity), where mode is the argument of this method
and someCapacity is the result of defaultBufferCapacity(thisArray) method. |
DataIntBuffer |
buffer(DataBuffer.AccessMode mode,
long capacity)
This method is fully implemented in this class. |
DataIntBuffer |
buffer(long capacity)
This implementation returns buffer(suitableMode, capacity), where capacity is the argument of this method
and suitableMode is
this instanceof UpdatableArray ?
DataBuffer.AccessMode.READ_WRITE :
DataBuffer.AccessMode.READ. |
void |
checkUnallowedMutation()
This implementation does nothing. |
java.lang.Class<?> |
elementType()
Returns the type of array elements. |
void |
flushResources(ArrayContext context,
boolean forcePhysicalWriting)
This implementation calls flushResources(context, 0, length(), forcePhysicalWriting). |
protected void |
flushResources(ArrayContext context,
long fromIndex,
long toIndex,
boolean forcePhysicalWriting)
This method implements all actions that should be performed by subArray(fromIndex, toIndex).flushResources(context, forcePhysicalWriting) |
void |
freeResources(ArrayContext context,
boolean forcePhysicalWriting)
This implementation calls freeResources(context, 0, length()), forcePhysicalWriting). |
protected void |
freeResources(ArrayContext context,
long fromIndex,
long toIndex,
boolean forcePhysicalWriting)
This method implements all actions that should be performed by subArray(fromIndex, toIndex).freeResources(context, forcePhysicalWriting) |
void |
getData(long arrayPos,
java.lang.Object destArray)
This implementation calls getData(long, Object, int, int)
with corresponding arguments. |
void |
getData(long arrayPos,
java.lang.Object destArray,
int destArrayOffset,
int count)
This implementation is based on a loop of calls of getInt(long) method. |
double |
getDouble(long index)
Returns the element #index converted to double: (double)(value&0xFF) for byte value, (double)(value&0xFFFF) for short value, (double)value for int, long, float, double, char values, or value?1.0:0.0 for boolean values. |
java.lang.Object |
getElement(long index)
This implementation returns getInt(index). |
abstract int |
getInt(long index)
Returns the element #index. |
long |
getLong(long index)
Returns the element #index converted to long: (long)value&0xFF for byte value, (long)value&0xFFFF for short value, (long)value for int, long, float, double, char values, or as value?1:0 for boolean values. |
long |
indexOf(long lowIndex,
long highIndex,
double value)
This implementation returns value==(int)value ? indexOf(lowIndex, highIndex, (int)value) : -1. |
long |
indexOf(long lowIndex,
long highIndex,
int value)
This implementation is based on a loop of calls of getInt(long) method
from index max(lowIndex,0) until index min(AbstractArray.length(),highIndex)-1. |
long |
indexOf(long lowIndex,
long highIndex,
long value)
This implementation returns value==(int)value ? indexOf(lowIndex, highIndex, (int)value) : -1. |
boolean |
isCopyOnNextWrite()
This implementation returns false. |
boolean |
isImmutable()
This implementation returns true. |
boolean |
isUnresizable()
This implementation returns true. |
long |
lastIndexOf(long lowIndex,
long highIndex,
double value)
This implementation returns value==(int)value ? lastIndexOf(lowIndex, highIndex, (int)value) : -1. |
long |
lastIndexOf(long lowIndex,
long highIndex,
int value)
This implementation is based on a loop of calls of getInt(long) method
from index min(AbstractArray.length(),highIndex)-1 back until index max(lowIndex,0). |
long |
lastIndexOf(long lowIndex,
long highIndex,
long value)
This implementation returns value==(int)value ? lastIndexOf(lowIndex, highIndex, (int)value) : -1. |
void |
loadResources(ArrayContext context)
This implementation calls loadResources(context, 0, length()). |
protected void |
loadResources(ArrayContext context,
long fromIndex,
long toIndex)
This method implements all actions that should be performed by subArray(fromIndex, toIndex).loadResources(context) |
long |
maxPossibleValue()
Returns 1 for BitArray,
0xFF for ByteArray,
0xFFFF for CharArray and ShortArray,
Integer.MAX_VALUE for IntArray,
Long.MAX_VALUE for LongArray. |
double |
maxPossibleValue(double valueForFloatingPoint)
Returns 1 for BitArray,
0xFF for ByteArray,
0xFFFF for CharArray and ShortArray,
Integer.MAX_VALUE for IntArray,
Long.MAX_VALUE for LongArray,
valueForFloatingPoint for FloatArray and DoubleArray. |
long |
minPossibleValue()
Returns 0 for BitArray, ByteArray, CharArray and ShortArray,
Integer.MIN_VALUE for IntArray,
Long.MIN_VALUE for LongArray. |
double |
minPossibleValue(double valueForFloatingPoint)
Returns 0 for BitArray, ByteArray, CharArray and ShortArray,
Integer.MIN_VALUE for IntArray,
Long.MIN_VALUE for LongArray,
valueForFloatingPoint for FloatArray and DoubleArray. |
MutableIntArray |
mutableClone(MemoryModel memoryModel)
This implementation performs the following: memoryModel. newArray(thisArray).copy(thisArray). |
java.lang.Class<? extends MutableIntArray> |
mutableType()
Returns the canonical resizable AlgART type of arrays with the same element types: the class of one of 9 basic interfaces, describing all kinds of resizable AlgART arrays for 8 primitive and any non-primitive element types. |
Array |
subArray(long fromIndex,
long toIndex)
This implementation returns new instance of AbstractIntArray with the same memory model,
underlying arrays and underlyingArraysAreParallel flag, that were passed
to the constructor of this instance,
and with overridden methods getInt(long) and
getData(long, Object, int, int),
calling the same methods of this instance with corresponding corrections of the arguments. |
java.lang.String |
toString()
Returns a brief string description of this object. |
java.lang.Class<? extends IntArray> |
type()
Returns the canonical AlgART type of this array: the class of one of 9 basic interfaces, describing all kinds of AlgART arrays for 8 primitive and any non-primitive element types. |
UpdatableIntArray |
updatableClone(MemoryModel memoryModel)
This implementation performs the following: memoryModel. newUnresizableArray(thisArray).copy(thisArray). |
java.lang.Class<? extends UpdatableIntArray> |
updatableType()
Returns the canonical updatable AlgART type of arrays with the same element types: the class of one of 9 basic interfaces, describing all kinds of updatable AlgART arrays for 8 primitive and any non-primitive element types. |
| Methods inherited from class net.algart.arrays.AbstractArray |
|---|
byteOrder, capacity, checkCopyArguments, checkSubArrArguments, checkSubArrayArguments, checkSwapArguments, defaultAppend, defaultBuffer, defaultBufferCapacity, defaultCopy, defaultCopy, defaultSwap, equals, equals, flushResources, freeResources, hashCode, hashCode, isLazy, isNew, isNewReadOnlyView, isZeroFilled, length, newJavaArray, setNewReadOnlyViewStatus, setNewStatus, shallowClone, standardObjectClone, subArr |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.algart.arrays.PArray |
|---|
isZeroFilled |
| Methods inherited from interface net.algart.arrays.Array |
|---|
byteOrder, capacity, equals, flushResources, freeResources, hashCode, isLazy, isNew, isNewReadOnlyView, length, newJavaArray, shallowClone, subArr |
| Constructor Detail |
|---|
protected AbstractIntArray(long initialCapacity,
long initialLength,
boolean underlyingArraysAreParallel,
Array... underlyingArrays)
The underlyingArraysAreParallel informs whether the passed underlying arrays (if they exist) are "parallel" to this one and to each other. Intuitively, it means that every element #k of this array is connected (for example, depends on) the elements #k (of, maybe, #k±i, where i is little) of the underlying arrays. Precisely, this argument affects the following in this implementation:
SizeMismatchException.
loadResources(ArrayContext context, long fromIndex, long toIndex),flushResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
andfreeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
loadResources(ArrayContext context),
flushResources(ArrayContext context, boolean forcePhysicalWriting) and
freeResources(ArrayContext context, boolean forcePhysicalWriting)
methods for the corresponding subarrays of all underlying
arrays. If this argument is false, thenloadResources(ArrayContext context, long fromIndex, long toIndex) does nothing,flushResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
and freeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
methods ignore their fromIndex / toIndex arguments and call
loadResources(ArrayContext context),
flushResources(ArrayContext context, boolean forcePhysicalWriting) and
freeResources(ArrayContext context, boolean forcePhysicalWriting)
methods for original underlying arrays (not their subarrays).loadResources(ArrayContext context, long fromIndex, long toIndex),
flushResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
and freeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)
methods and offer better implementations for subarrays,
for example, that will work with suitable regions of the underlying arrays.
The created array is not new by default.
This is correct usually, because this class is often used
for creating a view of another data. However, if the instance
if this class does not depend on any other data sources,
you may call setNewStatus(true) in
the constructor of your subclass.
The created array never has new-read-only-view status:
Array.isNewReadOnlyView() method always returns false in this class and its inheritors.
initialCapacity - initial capacity of the array.initialLength - initial length of the array.underlyingArraysAreParallel - whether the underlying arrays are "parallel" to this.underlyingArrays - see the same argument of
AbstractArray.AbstractArray(long, long, Array...).java.lang.NullPointerException - if underlyingArrays argument or some of underlyingArrays[k]
elements is null.java.lang.IllegalArgumentException - if the initialCapacity or initialLength arguments
are illegal (negative, or capacity < length).SizeMismatchException - if underlyingArraysAreParallel=true,
underlyingArrays.length>1 and some of passed arrays
have different lengths.
protected AbstractIntArray(long initialCapacityAndLength,
boolean underlyingArraysAreParallel,
Array... underlyingArrays)
AbstractIntArray(long, long, boolean, Array...),
where both initialCapacity and initialLength arguments are equal to
initialCapacityAndLength.
initialCapacityAndLength - initial capacity and length of the array.underlyingArraysAreParallel - see AbstractIntArray(long, long, boolean, Array...).underlyingArrays - see AbstractIntArray(long, long, boolean, Array...).java.lang.NullPointerException - if underlyingArrays argument or some of underlyingArrays[k]
elements is null.java.lang.IllegalArgumentException - if initialCapacityAndLength argument is negative.SizeMismatchException - if underlyingArraysAreParallel=true,
underlyingArrays.length>1 and some of passed arrays
have different lengths.| Method Detail |
|---|
public java.lang.Class<?> elementType()
ArrayBitArray,CharArray,ByteArray,ShortArray,IntArray),LongArray,FloatArray,DoubleArray.There is a guarantee that this method works very quickly (usually it just returns a value of some private field).
elementType in interface ArrayelementType in class AbstractArrayArrays.elementType(Class)public java.lang.Class<? extends IntArray> type()
ArrayBitArray.class, if this object is an instance of BitArray,CharArray.class, if this object is an instance of CharArray,ByteArray.class, if this object is an instance of ByteArray,ShortArray.class, if this object is an instance of ShortArray,IntArray.class, if this object is an instance of IntArray,LongArray.class, if this object is an instance of LongArray,FloatArray.class, if this object is an instance of FloatArray,DoubleArray.class, if this object is an instance of DoubleArray,ObjectArray.class, if this object is an instance of ObjectArray.There is a guarantee that this method works very quickly (usually it just returns a constant value).
type in interface Arraytype in interface IntArraytype in interface PArraytype in interface PIntegerArraytype in interface PNumberArraytype in class AbstractArraypublic java.lang.Class<? extends UpdatableIntArray> updatableType()
ArrayUpdatableBitArray.class, if this object is an instance of BitArray,UpdatableCharArray.class, if this object is an instance of CharArray,UpdatableByteArray.class, if this object is an instance of ByteArray,UpdatableShortArray.class, if this object is an instance of ShortArray,UpdatableIntArray.class, if this object is an instance of IntArray,UpdatableLongArray.class, if this object is an instance of LongArray,UpdatableFloatArray.class, if this object is an instance of FloatArray,UpdatableDoubleArray.class, if this object is an instance of DoubleArray,UpdatableObjectArray.class, if this object is an instance of ObjectArray.There is a guarantee that this method works very quickly (usually it just returns a constant value).
updatableType in interface ArrayupdatableType in interface IntArrayupdatableType in interface PArrayupdatableType in interface PIntegerArrayupdatableType in interface PNumberArrayupdatableType in class AbstractArraypublic java.lang.Class<? extends MutableIntArray> mutableType()
ArrayMutableBitArray.class, if this object is an instance of BitArray,MutableCharArray.class, if this object is an instance of CharArray,MutableByteArray.class, if this object is an instance of ByteArray,MutableShortArray.class, if this object is an instance of ShortArray,MutableIntArray.class, if this object is an instance of IntArray,MutableLongArray.class, if this object is an instance of LongArray,MutableFloatArray.class, if this object is an instance of FloatArray,MutableDoubleArray.class, if this object is an instance of DoubleArray,MutableObjectArray.class, if this object is an instance of ObjectArray.There is a guarantee that this method works very quickly (usually it just returns a constant value).
mutableType in interface ArraymutableType in interface IntArraymutableType in interface PArraymutableType in interface PIntegerArraymutableType in interface PNumberArraymutableType in class AbstractArray
public void getData(long arrayPos,
java.lang.Object destArray,
int destArrayOffset,
int count)
getInt(long) method.
Please override this method if it's possible to perform the same task more efficiently
than such a loop.
getData in interface ArraygetData in class AbstractArrayarrayPos - starting position in this AlgART array.destArray - the target Java array.destArrayOffset - starting position in the target Java array.count - the number of elements to be copied.java.lang.NullPointerException - if destArray argument is null.java.lang.IllegalArgumentException - if destArray argument is not an array.java.lang.IndexOutOfBoundsException - if copying would cause access of data outside this array or target array.java.lang.ArrayStoreException - if destArray element type mismatches with this array
elementType().java.lang.ClassCastException - if destArray element type mismatches with this array
elementType()
(both this and ArrayStoreException are possible,
depending on implementation).DirectAccessible,
UpdatableArray.setData(long, Object, int, int),
BitArray.getBits(long, long[], long, long)
public void getData(long arrayPos,
java.lang.Object destArray)
getData(long, Object, int, int)
with corresponding arguments.
getData in interface ArraygetData in class AbstractArrayarrayPos - starting position in this AlgART array.destArray - the target Java array.java.lang.NullPointerException - if destArray argument is null.java.lang.IllegalArgumentException - if destArray argument is not an array.java.lang.IndexOutOfBoundsException - if arrayPos is out of range 0..length()-1.java.lang.ArrayStoreException - if destArray element type mismatches with this array
elementType().java.lang.ClassCastException - if destArray element type mismatches with this array
elementType()
(both this and ArrayStoreException are possible,
depending on implementation).DirectAccessible,
Array.getData(long, Object, int, int),
UpdatableArray.setData(long, Object)public java.lang.Object getElement(long index)
getElement in interface ArraygetElement in class AbstractArrayindex - index of element to get.java.lang.IndexOutOfBoundsException - if index is out of range 0..length()-1.
public Array subArray(long fromIndex,
long toIndex)
AbstractIntArray with the same memory model,
underlying arrays and underlyingArraysAreParallel flag, that were passed
to the constructor of this instance,
and with overridden methods getInt(long) and
getData(long, Object, int, int),
calling the same methods of this instance with corresponding corrections of the arguments.
The returned instance also have overridden methods loadResources(ArrayContext, long, long),
flushResources(ArrayContext, long, long, boolean) and
freeResources(ArrayContext, long, long, boolean),
that also call the same methods of this instance with corresponding correction of their fromIndex
argument.
The returned instance also have overridden method AbstractArray.isLazy(),
that just calls the same methods of this instance with the same arguments.
subArray in interface ArraysubArray in class AbstractArrayfromIndex - low endpoint (inclusive) of the subarray.toIndex - high endpoint (exclusive) of the subarray.java.lang.IndexOutOfBoundsException - for illegal fromIndex and toIndex
(fromIndex < 0 || toIndex > length() || fromIndex > toIndex).Array.subArr(long, long)
public DataIntBuffer buffer(DataBuffer.AccessMode mode,
long capacity)
AbstractArrayThe returned buffer will be direct,
if mode is not PRIVATE,
this array is not immutable,
is not copy-on-next-write,
and either it implements DirectAccessible interface and
its hasJavaArray() method returns true,
or it is a bit array created by the simple memory model.
buffer in interface Arraybuffer in interface IntArraybuffer in class AbstractArraymode - the access mode for new buffer.capacity - the capacity of the bufferArray.buffer(net.algart.arrays.DataBuffer.AccessMode),
Array.buffer(long),
Array.buffer()public DataIntBuffer buffer(DataBuffer.AccessMode mode)
AbstractArraybuffer(mode, someCapacity), where mode is the argument of this method
and someCapacity is the result of defaultBufferCapacity(thisArray) method.
buffer in interface Arraybuffer in interface IntArraybuffer in class AbstractArraymode - the access mode for new buffer.public DataIntBuffer buffer(long capacity)
AbstractArraybuffer(suitableMode, capacity), where capacity is the argument of this method
and suitableMode is
this instanceof UpdatableArray ?
DataBuffer.AccessMode.READ_WRITE :
DataBuffer.AccessMode.READ.
buffer in interface Arraybuffer in interface IntArraybuffer in class AbstractArraycapacity - the capacity of the buffer.public DataIntBuffer buffer()
AbstractArraybuffer(suitableMode), where suitableMode is
this instanceof UpdatableArray ?
DataBuffer.AccessMode.READ_WRITE :
DataBuffer.AccessMode.READ.
buffer in interface Arraybuffer in interface IntArraybuffer in class AbstractArraypublic long bitsPerElement()
PArrayArray.capacity()*bitsPerElement()/8 bytes
(when the array capacity is large enough).
If the number of occupied bits is not defined (for example, may depend on JVM implementation), this method returns -1.
For implementations from this package, this method returns:
BitArray (the value of Arrays.BITS_PER_BIT constant),CharArray (the value of Arrays.BITS_PER_CHAR constant),ByteArray (the value of Arrays.BITS_PER_BYTE constant),ShortArray (the value of Arrays.BITS_PER_SHORT constant),IntArray (the value of Arrays.BITS_PER_INT constant),LongArray (the value of Arrays.BITS_PER_LONG constant),FloatArray (the value of Arrays.BITS_PER_FLOAT constant),DoubleArray (the value of Arrays.BITS_PER_DOUBLE constant).(-1 result is never returned by implementations from this package.)
Please keep in mind that the real amount of occupied memory, theoretically, can differ
from the value returned by this method.
For example, some JVM, theoretically, may store byte elements of byte[] array
in 32-bit memory words. In this case, this method will return invalid result for byte arrays
created by the simple memory model.
However: we guarantee the results of this method are always correct for arrays created
by the buffer memory model and large memory model.
There is a guarantee that this method works very quickly (usually it just returns a constant or a value of some private field).
bitsPerElement in interface PArrayArrays.bitsPerElement(Class)public double getDouble(long index)
PArray
getDouble in interface PArrayindex - index of element to get.UpdatablePArray.setDouble(long, double)
public long indexOf(long lowIndex,
long highIndex,
double value)
indexOf(lowIndex, highIndex, (int)value) : -1.
indexOf in interface PArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.
public long lastIndexOf(long lowIndex,
long highIndex,
double value)
lastIndexOf(lowIndex, highIndex, (int)value) : -1.
lastIndexOf in interface PArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.public long getLong(long index)
PFixedArray
getLong in interface PFixedArrayindex - index of element to get.UpdatablePArray.setLong(long, long)
public long indexOf(long lowIndex,
long highIndex,
long value)
indexOf(lowIndex, highIndex, (int)value) : -1.
indexOf in interface PFixedArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.
public long lastIndexOf(long lowIndex,
long highIndex,
long value)
lastIndexOf(lowIndex, highIndex, (int)value) : -1.
lastIndexOf in interface PFixedArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.public abstract int getInt(long index)
IntArray
getInt in interface IntArraygetInt in interface PFixedArrayindex - index of element to get.UpdatablePArray.setInt(long, int)
public long indexOf(long lowIndex,
long highIndex,
int value)
getInt(long) method
from index max(lowIndex,0) until index min(AbstractArray.length(),highIndex)-1.
Please override this method if it's possible to perform the same task more efficiently
than such a loop.
indexOf in interface IntArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.
public long lastIndexOf(long lowIndex,
long highIndex,
int value)
getInt(long) method
from index min(AbstractArray.length(),highIndex)-1 back until index max(lowIndex,0).
Please override this method if it's possible to perform the same task more efficiently
than such a loop.
lastIndexOf in interface IntArraylowIndex - the low index in the array for search (inclusive).highIndex - the high index in the array for search (exclusive).value - the value to be found.public boolean isImmutable()
isImmutable in interface ArrayisImmutable in class AbstractArrayArray.asImmutable()public boolean isUnresizable()
isUnresizable in interface ArrayisUnresizable in class AbstractArrayUpdatableArray.asUnresizable()
public void checkUnallowedMutation()
throws UnallowedMutationError
checkUnallowedMutation in interface ArraycheckUnallowedMutation in class AbstractArrayUnallowedMutationError - never in this implementation.Array.asTrustedImmutable()public IntArray asTrustedImmutable()
asImmutable() and returns its result.
asTrustedImmutable in interface ArrayasTrustedImmutable in interface IntArrayasTrustedImmutable in interface PArrayasTrustedImmutable in interface PFixedArrayasTrustedImmutable in interface PIntegerArrayasTrustedImmutable in class AbstractArrayArray.asImmutable(),
Array.checkUnallowedMutation()public Array asCopyOnNextWrite()
asCopyOnNextWrite in interface ArrayasCopyOnNextWrite in class AbstractArrayArray.isCopyOnNextWrite(),
MemoryModel.newLazyCopy(Array),
MemoryModel.newUnresizableLazyCopy(Array)public boolean isCopyOnNextWrite()
isCopyOnNextWrite in interface ArrayisCopyOnNextWrite in class AbstractArrayArray.asCopyOnNextWrite()public IntArray asImmutable()
asImmutable in interface ArrayasImmutable in interface IntArrayasImmutable in interface PArrayasImmutable in interface PFixedArrayasImmutable in interface PIntegerArrayasImmutable in class AbstractArrayArray.isImmutable(),
Array.asTrustedImmutable(),
Array.mutableClone(MemoryModel),
Array.updatableClone(MemoryModel),
UpdatableArray.asUnresizable()public MutableIntArray mutableClone(MemoryModel memoryModel)
AbstractArraynewArray(thisArray).copy(thisArray).
mutableClone in interface ArraymutableClone in interface IntArraymutableClone in interface PArraymutableClone in interface PFixedArraymutableClone in interface PIntegerArraymutableClone in class AbstractArraymemoryModel - the memory model, used for allocation a new copy of this array.Array.updatableClone(MemoryModel)public UpdatableIntArray updatableClone(MemoryModel memoryModel)
AbstractArraynewUnresizableArray(thisArray).copy(thisArray).
updatableClone in interface ArrayupdatableClone in interface IntArrayupdatableClone in interface PArrayupdatableClone in interface PFixedArrayupdatableClone in interface PIntegerArrayupdatableClone in class AbstractArraymemoryModel - the memory model, used for allocation a new copy of this array.Array.mutableClone(MemoryModel)public void loadResources(ArrayContext context)
loadResources(context, 0, length()).
loadResources in interface ArrayloadResources in class AbstractArraycontext - the context of execution; may be null, then it will be ignored.Array.freeResources(ArrayContext),
Array.flushResources(ArrayContext),
Array.flushResources(ArrayContext, boolean)
public void flushResources(ArrayContext context,
boolean forcePhysicalWriting)
flushResources(context, 0, length(), forcePhysicalWriting).
flushResources in interface ArrayflushResources in class AbstractArraycontext - the context of execution; may be null, then it will be ignored.forcePhysicalWriting - is it necessary to try forcing physical writing all associated resources
to the external device.Array.loadResources(ArrayContext),
Array.flushResources(ArrayContext),
Array.freeResources(ArrayContext, boolean)
public void freeResources(ArrayContext context,
boolean forcePhysicalWriting)
freeResources(context, 0, length()), forcePhysicalWriting).
freeResources in interface ArrayfreeResources in class AbstractArraycontext - the context of execution; may be null, then it will be ignored.forcePhysicalWriting - is it necessary to try forcing physical writing all associated resources
to the external device.Array.loadResources(ArrayContext context),
Array.flushResources(ArrayContext context, boolean forcePhysicalWriting),
Array.freeResources(ArrayContext),
Arrays.freeAllResources()
protected void loadResources(ArrayContext context,
long fromIndex,
long toIndex)
subArray(fromIndex, toIndex).loadResources(context)loadResources(c)
(where c is a necessary part of the passed context)
for the corresponding subarray
of all underlying arrays, passed via the last argument of the constructor,
if the underlyingArraysAreParallel constructor argument was true,
or does nothing in other case.
context - the context of execution; may be null, then it will be ignored.fromIndex - low endpoint (inclusive) of the subarray that should be loaded.toIndex - high endpoint (exclusive) of the subarray that should be loaded.java.lang.IndexOutOfBoundsException - for illegal fromIndex and toIndex
(fromIndex < 0 || toIndex > length() || fromIndex > toIndex).
protected void flushResources(ArrayContext context,
long fromIndex,
long toIndex,
boolean forcePhysicalWriting)
subArray(fromIndex, toIndex).flushResources(context, forcePhysicalWriting)flushResources(c, forcePhysicalWriting)
(where c is a necessary part of the passed context)
for the corresponding subarray of all underlying arrays, passed via the last argument of the constructor,
if the underlyingArraysAreParallel constructor argument was true,
or for original underlying arrays in other case
(alike AbstractArray.flushResources(ArrayContext, boolean)).
context - the context of execution; may be null, then it will be ignored.fromIndex - low endpoint (inclusive) of the subarray that should be flushed.toIndex - high endpoint (exclusive) of the subarray that should be flushed.forcePhysicalWriting - is it necessary to try forcing physical writing all associated resources
to the external device.java.lang.IndexOutOfBoundsException - for illegal fromIndex and toIndex
(fromIndex < 0 || toIndex > length() || fromIndex > toIndex).
protected void freeResources(ArrayContext context,
long fromIndex,
long toIndex,
boolean forcePhysicalWriting)
subArray(fromIndex, toIndex).freeResources(context, forcePhysicalWriting)freeResources(c, forcePhysicalWriting)
(where c is a necessary part of the passed context)
for the corresponding subarray of all underlying arrays, passed via the last argument of the constructor,
if the underlyingArraysAreParallel constructor argument was true,
or for original underlying arrays in other case
(alike AbstractArray.freeResources(ArrayContext, boolean)).
context - the context of execution; may be null, then it will be ignored.fromIndex - low endpoint (inclusive) of the subarray that should be freed.toIndex - high endpoint (exclusive) of the subarray that should be freed.forcePhysicalWriting - is it necessary to try forcing physical writing all associated resources
to the external device.java.lang.IndexOutOfBoundsException - for illegal fromIndex and toIndex
(fromIndex < 0 || toIndex > length() || fromIndex > toIndex).public java.lang.String toString()
ArrayThe result of this method may depend on implementation and usually contains a short description of the array length, capacity, element type.
Note: for character arrays, unlike CharSequence.toString(),
this method works as for all other array types.
If you need to convert a character array to a string,
containing all characters of the array, you may use
Arrays.toString(CharArray) method.
toString in interface ArraytoString in class AbstractArraypublic double minPossibleValue(double valueForFloatingPoint)
PArrayBitArray, ByteArray, CharArray and ShortArray,
Integer.MIN_VALUE for IntArray,
Long.MIN_VALUE for LongArray,
valueForFloatingPoint for FloatArray and DoubleArray.
For fixed-point arrays it is the minimal possible value,
that can stored in elements of this array
(byte and short elements are interpreted as unsigned).
This method is equivalent to
minPossibleValue(thisArray.getClass(),
valueForFloatingPoint).
minPossibleValue in interface PArrayvalueForFloatingPoint - the value returned for floating-point array type.PFixedArray.minPossibleValue()public double maxPossibleValue(double valueForFloatingPoint)
PArrayBitArray,
0xFF for ByteArray,
0xFFFF for CharArray and ShortArray,
Integer.MAX_VALUE for IntArray,
Long.MAX_VALUE for LongArray,
valueForFloatingPoint for FloatArray and DoubleArray.
For fixed-point arrays it is the maximal possible value,
that can stored in elements of this array
(byte and short elements are interpreted as unsigned).
This method is equivalent to
maxPossibleValue(thisArray.getClass(),
valueForFloatingPoint).
maxPossibleValue in interface PArrayvalueForFloatingPoint - the value returned for floating-point array type.PFixedArray.maxPossibleValue()public long minPossibleValue()
PFixedArrayBitArray, ByteArray, CharArray and ShortArray,
Integer.MIN_VALUE for IntArray,
Long.MIN_VALUE for LongArray.
It is the minimal possible value,
that can stored in elements of this array
(byte and short elements are interpreted as unsigned).
This method is equivalent to
minPossibleIntegerValue(thisArray.getClass()).
minPossibleValue in interface PFixedArrayPArray.minPossibleValue(double)public long maxPossibleValue()
PFixedArrayBitArray,
0xFF for ByteArray,
0xFFFF for CharArray and ShortArray,
Integer.MAX_VALUE for IntArray,
Long.MAX_VALUE for LongArray.
valueForFloatingPoint for FloatArray and DoubleArray.
It is the maximal possible value,
that can stored in elements of this array
(byte and short elements are interpreted as unsigned).
This method is equivalent to
maxPossibleIntegerValue(thisArray.getClass()).
maxPossibleValue in interface PFixedArrayPArray.maxPossibleValue(double)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||