Class AbstractObjectArray<E>
- All Implemented Interfaces:
Cloneable,Array,ObjectArray<E>
- Direct Known Subclasses:
AbstractUpdatableObjectArray
Implementation of almost all basic functions of ObjectArray interface.
The only ObjectArray.get(long) method is not defined in this class;
all other methods are implemented via calls of ObjectArray.get(long).
- Author:
- Daniel Alievsky
-
Field Summary
Fields inherited from class net.algart.arrays.AbstractArray
capacity, length, underlyingArrays -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractObjectArray(Class<E> elementType, long initialCapacityAndLength, boolean underlyingArraysAreParallel, Array... underlyingArrays) Equivalent to the constructorAbstractObjectArray(Class, long, long, boolean, Array...), where both initialCapacity and initialLength arguments are equal to initialCapacityAndLength.protectedAbstractObjectArray(Class<E> elementType, long initialCapacity, long initialLength, boolean underlyingArraysAreParallel, Array... underlyingArrays) Creates an array with the given initial capacity and length. -
Method Summary
Modifier and TypeMethodDescriptionThis implementation returns this object.This implementation returns this object.This implementation callsasImmutable()and returns its result.buffer()This implementation returnsbuffer(suitableMode), where suitableMode is this instanceof UpdatableArray ? DataBuffer.AccessMode.READ_WRITE : DataBuffer.AccessMode.READ.buffer(long capacity) This implementation returnsbuffer(suitableMode, capacity), where capacity is the argument of this method and suitableMode is this instanceof UpdatableArray ? DataBuffer.AccessMode.READ_WRITE : DataBuffer.AccessMode.READ.buffer(DataBuffer.AccessMode mode) This implementation returnsbuffer(mode, someCapacity), where mode is the argument of this method and someCapacity is the result ofdefaultBufferCapacity(thisArray)method.buffer(DataBuffer.AccessMode mode, long capacity) This method is fully implemented in this class.<D> ObjectArray<D>Returns this array cast to the specified generic element type or throws ClassCastException if the elements cannot be cast to the required type (because theelement typeis not its subclass).voidThis implementation does nothing.Returns the type of array elements.voidflushResources(ArrayContext context, boolean forcePhysicalWriting) This implementation callsflushResources(context, 0, length(), forcePhysicalWriting).protected voidflushResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting) This method implements all actions that should be performed by call.subArray(fromIndex, toIndex).flushResources(context, forcePhysicalWriting)voidfreeResources(ArrayContext context, boolean forcePhysicalWriting) This implementation callsfreeResources(context, 0, length()), forcePhysicalWriting).protected voidfreeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting) This method implements all actions that should be performed by call.subArray(fromIndex, toIndex).freeResources(context, forcePhysicalWriting)abstract Eget(long index) Equivalent togetElement(index).voidThis implementation callsgetData(long, Object, int, int)with corresponding arguments.voidThis implementation is based on a loop of calls ofget(long)method.getElement(long index) This implementation returns get(index).longThis implementation is based on a loop of calls ofget(long)method from index max(lowIndex,0) until index min(AbstractArray.length(),highIndex)-1.booleanThis implementation returns false.booleanThis implementation returns true.booleanThis implementation returns true.E[]ja()This implementation performs the following code:longlastIndexOf(long lowIndex, long highIndex, E value) This implementation is based on a loop of calls ofget(long)method from index min(AbstractArray.length(),highIndex)-1 back until index max(lowIndex,0).voidloadResources(ArrayContext context) This implementation callsloadResources(context, 0, length()).protected voidloadResources(ArrayContext context, long fromIndex, long toIndex) This method implements all actions that should be performed by call.subArray(fromIndex, toIndex).loadResources(context)mutableClone(MemoryModel memoryModel) Class<? extends MutableObjectArray<E>>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.subArray(long fromIndex, long toIndex) This implementation returns new instance ofAbstractObjectArraywith the same memory model and underlying arrays, that were passed to the constructor of this instance, and with overridden methodsget(long)andgetData(long arrayPos, Object destArray, int destArrayOffset, int count), calling the same methods of this instance with corresponding corrections of the arguments.toString()Returns a brief string description of this object.Class<? extends ObjectArray<E>>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.updatableClone(MemoryModel memoryModel) This implementation performs the following: memoryModel.newUnresizableArray(thisArray).copy(thisArray).Class<? extends UpdatableObjectArray<E>>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, subArrMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.algart.arrays.Array
byteOrder, capacity, equals, flushResources, freeResources, hashCode, isEmpty, isLazy, isNew, isNewReadOnlyView, length, length32, newJavaArray, shallowClone, subArrMethods inherited from interface net.algart.arrays.ObjectArray
matrix
-
Constructor Details
-
AbstractObjectArray
protected AbstractObjectArray(Class<E> elementType, long initialCapacity, long initialLength, boolean underlyingArraysAreParallel, Array... underlyingArrays) Creates an array with the given initial capacity and length.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:
- If it is true, then all passed underlying arrays (if underlyingArrays.length>1)
must have identical length — in other case, this constructor throws
SizeMismatchException. - If it is true, then
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)andfreeResources(ArrayContext context, boolean forcePhysicalWriting)methods for the correspondingsubarraysof 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)andfreeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting)methods ignore their fromIndex / toIndex arguments and callloadResources(ArrayContext context),flushResources(ArrayContext context, boolean forcePhysicalWriting)andfreeResources(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)andfreeResources(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.
This array is not
newby 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 callsetNewStatus(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.- Parameters:
elementType- theelement typeof this array.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 ofAbstractArray(long, long, Array...).- Throws:
NullPointerException- if underlyingArrays argument or some of underlyingArrays[k] elements is null.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.
- If it is true, then all passed underlying arrays (if underlyingArrays.length>1)
must have identical length — in other case, this constructor throws
-
AbstractObjectArray
protected AbstractObjectArray(Class<E> elementType, long initialCapacityAndLength, boolean underlyingArraysAreParallel, Array... underlyingArrays) Equivalent to the constructorAbstractObjectArray(Class, long, long, boolean, Array...), where both initialCapacity and initialLength arguments are equal to initialCapacityAndLength.- Parameters:
elementType- theelement typeof this array.initialCapacityAndLength- initial capacity and length of the array.underlyingArraysAreParallel- seeAbstractObjectArray(Class, long, long, boolean, Array...).underlyingArrays- seeAbstractObjectArray(Class, long, long, boolean, Array...).- Throws:
NullPointerException- if underlyingArrays argument or some of underlyingArrays[k] elements is null.IllegalArgumentException- if initialCapacityAndLength argument is negative.SizeMismatchException- if underlyingArraysAreParallel=true, underlyingArrays.length>1 and some of passed arrays have different lengths.
-
-
Method Details
-
elementType
Description copied from interface:ArrayReturns the type of array elements. For arrays of primitive types, returns:- boolean.class for
BitArray, - char.class for
CharArray, - byte.class for
ByteArray, - short.class for
ShortArray, - int.class for
IntArray), - long.class for
LongArray, - float.class for
FloatArray, - double.class for
DoubleArray.
There is a guarantee that this method works very quickly (usually it just returns a value of some private field).
- Specified by:
elementTypein interfaceArray- Specified by:
elementTypein interfaceObjectArray<E>- Specified by:
elementTypein classAbstractArray- Returns:
- the type of array elements.
- See Also:
- boolean.class for
-
type
Description copied from interface:ArrayReturns 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. More precisely, returns:BitArray.class, if this object is an instance ofBitArray,CharArray.class, if this object is an instance ofCharArray,ByteArray.class, if this object is an instance ofByteArray,ShortArray.class, if this object is an instance ofShortArray,IntArray.class, if this object is an instance ofIntArray,LongArray.class, if this object is an instance ofLongArray,FloatArray.class, if this object is an instance ofFloatArray,DoubleArray.class, if this object is an instance ofDoubleArray,ObjectArray.class, if this object is an instance ofObjectArray.
There is a guarantee that this method works very quickly (usually it just returns a constant value).
- Specified by:
typein interfaceArray- Specified by:
typein interfaceObjectArray<E>- Specified by:
typein classAbstractArray- Returns:
- canonical AlgART type of this array.
-
updatableType
Description copied from interface:ArrayReturns 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. More precisely, returns:UpdatableBitArray.class, if this object is an instance ofBitArray,UpdatableCharArray.class, if this object is an instance ofCharArray,UpdatableByteArray.class, if this object is an instance ofByteArray,UpdatableShortArray.class, if this object is an instance ofShortArray,UpdatableIntArray.class, if this object is an instance ofIntArray,UpdatableLongArray.class, if this object is an instance ofLongArray,UpdatableFloatArray.class, if this object is an instance ofFloatArray,UpdatableDoubleArray.class, if this object is an instance ofDoubleArray,UpdatableObjectArray.class, if this object is an instance ofObjectArray.
There is a guarantee that this method works very quickly (usually it just returns a constant value).
- Specified by:
updatableTypein interfaceArray- Specified by:
updatableTypein interfaceObjectArray<E>- Specified by:
updatableTypein classAbstractArray- Returns:
- canonical AlgART type of an updatable array of the same kind.
-
mutableType
Description copied from interface:ArrayReturns 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. More precisely, returns:MutableBitArray.class, if this object is an instance ofBitArray,MutableCharArray.class, if this object is an instance ofCharArray,MutableByteArray.class, if this object is an instance ofByteArray,MutableShortArray.class, if this object is an instance ofShortArray,MutableIntArray.class, if this object is an instance ofIntArray,MutableLongArray.class, if this object is an instance ofLongArray,MutableFloatArray.class, if this object is an instance ofFloatArray,MutableDoubleArray.class, if this object is an instance ofDoubleArray,MutableObjectArray.class, if this object is an instance ofObjectArray.
There is a guarantee that this method works very quickly (usually it just returns a constant value).
- Specified by:
mutableTypein interfaceArray- Specified by:
mutableTypein interfaceObjectArray<E>- Specified by:
mutableTypein classAbstractArray- Returns:
- canonical AlgART type of a resizable array of the same kind.
-
getData
This implementation is based on a loop of calls ofget(long)method. Please override this method if it's possible to perform the same task more efficiently than such a loop.- Specified by:
getDatain interfaceArray- Specified by:
getDatain classAbstractArray- Parameters:
arrayPos- 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.- Throws:
NullPointerException- if destArray argument is null.IllegalArgumentException- if destArray argument is not an array.IndexOutOfBoundsException- if copying would cause access of data outside this array or target array.ArrayStoreException- if destArray element type mismatches with this arrayelementType().ClassCastException- if destArray element type mismatches with this arrayelementType()(both this and ArrayStoreException are possible, depending on implementation).- See Also:
-
getData
This implementation callsgetData(long, Object, int, int)with corresponding arguments.- Specified by:
getDatain interfaceArray- Specified by:
getDatain classAbstractArray- Parameters:
arrayPos- starting position in this AlgART array.destArray- the target Java array.- Throws:
NullPointerException- if destArray argument is null.IllegalArgumentException- if destArray argument is not an array.IndexOutOfBoundsException- if arrayPos is out of range 0..length()-1.ArrayStoreException- if destArray element type mismatches with this arrayelementType().ClassCastException- if destArray element type mismatches with this arrayelementType()(both this and ArrayStoreException are possible, depending on implementation).- See Also:
-
getElement
This implementation returns get(index).- Specified by:
getElementin interfaceArray- Specified by:
getElementin classAbstractArray- Parameters:
index- index of element to get.- Returns:
- the element at the specified position in this array.
- Throws:
IndexOutOfBoundsException- if index is out of range 0..length()-1.
-
cast
Description copied from interface:ObjectArrayReturns this array cast to the specified generic element type or throws ClassCastException if the elements cannot be cast to the required type (because theelement typeis not its subclass). Equivalent to (ObjectArray)thisArray , but is compiled without "unchecked cast" warning or "inconvertible type" error.Unlike ArrayList architecture, such casting is safe here, because all methods, storing data in the AlgART array, always check the
element typeand do not allow saving illegal elements.- Specified by:
castin interfaceObjectArray<E>- Parameters:
elementType- the required generic type.- Returns:
- this array cast to the specified generic element type.
-
subArray
This implementation returns new instance ofAbstractObjectArraywith the same memory model and underlying arrays, that were passed to the constructor of this instance, and with overridden methodsget(long)andgetData(long arrayPos, Object destArray, int destArrayOffset, int count), 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)andfreeResources(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.- Specified by:
subArrayin interfaceArray- Specified by:
subArrayin classAbstractArray- Parameters:
fromIndex- low endpoint (inclusive) of the subarray.toIndex- high endpoint (exclusive) of the subarray.- Returns:
- a view of the specified range within this array.
- Throws:
IndexOutOfBoundsException- for illegal fromIndex and toIndex (fromIndex < 0 || toIndex > length() || fromIndex > toIndex).- See Also:
-
buffer
Description copied from class:AbstractArrayThis method is fully implemented in this class.The returned buffer will be direct, if mode is not
PRIVATE, this array is notimmutable, is notcopy-on-next-write, and either it implementsDirectAccessibleinterface and itshasJavaArray()method returns true, or it is a bit array created by thesimple memory model.- Specified by:
bufferin interfaceArray- Specified by:
bufferin interfaceObjectArray<E>- Overrides:
bufferin classAbstractArray- Parameters:
mode- the access mode for new buffer.capacity- the capacity of the buffer- Returns:
- new data buffer for accessing this array.
- See Also:
-
buffer
Description copied from class:AbstractArrayThis implementation returnsbuffer(mode, someCapacity), where mode is the argument of this method and someCapacity is the result ofdefaultBufferCapacity(thisArray)method.- Specified by:
bufferin interfaceArray- Specified by:
bufferin interfaceObjectArray<E>- Overrides:
bufferin classAbstractArray- Parameters:
mode- the access mode for new buffer.- Returns:
- new data buffer for accessing this array.
-
buffer
Description copied from class:AbstractArrayThis implementation returnsbuffer(suitableMode, capacity), where capacity is the argument of this method and suitableMode is this instanceof UpdatableArray ? DataBuffer.AccessMode.READ_WRITE : DataBuffer.AccessMode.READ.- Specified by:
bufferin interfaceArray- Specified by:
bufferin interfaceObjectArray<E>- Overrides:
bufferin classAbstractArray- Parameters:
capacity- the capacity of the buffer.- Returns:
- new data buffer for accessing this array.
-
buffer
Description copied from class:AbstractArrayThis implementation returnsbuffer(suitableMode), where suitableMode is this instanceof UpdatableArray ? DataBuffer.AccessMode.READ_WRITE : DataBuffer.AccessMode.READ.- Specified by:
bufferin interfaceArray- Specified by:
bufferin interfaceObjectArray<E>- Overrides:
bufferin classAbstractArray- Returns:
- new data buffer for accessing this array.
-
get
Description copied from interface:ObjectArrayEquivalent togetElement(index).- Specified by:
getin interfaceObjectArray<E>- Parameters:
index- index of element to get.- Returns:
- the element at the specified position in this array.
-
indexOf
This implementation is based on a loop of calls ofget(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.- Specified by:
indexOfin interfaceObjectArray<E>- Parameters:
lowIndex- 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.- Returns:
- the index of the first occurrence of this value in this array in range lowIndex<=index<highIndex, or -1 if this value does not occur in this range.
-
lastIndexOf
This implementation is based on a loop of calls ofget(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.- Specified by:
lastIndexOfin interfaceObjectArray<E>- Parameters:
lowIndex- 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.- Returns:
- the index of the last occurrence of this value in this array in range lowIndex<=index<highIndex, or -1 if this value does not occur in this range.
-
isImmutable
public boolean isImmutable()This implementation returns true. Should be overridden if the inheritor is mutable.- Specified by:
isImmutablein interfaceArray- Specified by:
isImmutablein classAbstractArray- Returns:
- true if this instance is immutable.
- See Also:
-
isUnresizable
public boolean isUnresizable()This implementation returns true. Should be overridden if the inheritor is resizable- Specified by:
isUnresizablein interfaceArray- Specified by:
isUnresizablein classAbstractArray- Returns:
- true if this instance is unresizable.
- See Also:
-
checkUnallowedMutation
This implementation does nothing.- Specified by:
checkUnallowedMutationin interfaceArray- Specified by:
checkUnallowedMutationin classAbstractArray- Throws:
UnallowedMutationError- never in this implementation.- See Also:
-
asTrustedImmutable
This implementation callsasImmutable()and returns its result.- Specified by:
asTrustedImmutablein interfaceArray- Specified by:
asTrustedImmutablein interfaceObjectArray<E>- Specified by:
asTrustedImmutablein classAbstractArray- Returns:
- a trusted immutable view of this array (or a reference to this array if it is already trusted immutable).
- See Also:
-
asCopyOnNextWrite
This implementation returns this object. Should be overridden if the inheritor is mutable.- Specified by:
asCopyOnNextWritein interfaceArray- Specified by:
asCopyOnNextWritein classAbstractArray- Returns:
- a copy-on-next-write view of this array (or a reference to this array if it is immutable or already copy-on-next-write).
- See Also:
-
isCopyOnNextWrite
public boolean isCopyOnNextWrite()This implementation returns false. Should be overridden if the inheritor is mutable.- Specified by:
isCopyOnNextWritein interfaceArray- Specified by:
isCopyOnNextWritein classAbstractArray- Returns:
- true if this array is in copy-on-next-write mode
- See Also:
-
asImmutable
This implementation returns this object. Should be overridden if the inheritor is mutable.- Specified by:
asImmutablein interfaceArray- Specified by:
asImmutablein interfaceObjectArray<E>- Specified by:
asImmutablein classAbstractArray- Returns:
- an immutable view of this array (or a reference to this array if it is immutable).
- See Also:
-
mutableClone
Description copied from class:AbstractArray- Specified by:
mutableClonein interfaceArray- Specified by:
mutableClonein interfaceObjectArray<E>- Overrides:
mutableClonein classAbstractArray- Parameters:
memoryModel- the memory model, used for allocation a new copy of this array.- Returns:
- a mutable copy of this array.
- See Also:
-
updatableClone
Description copied from class:AbstractArrayThis implementation performs the following: memoryModel.newUnresizableArray(thisArray).copy(thisArray).- Specified by:
updatableClonein interfaceArray- Specified by:
updatableClonein interfaceObjectArray<E>- Overrides:
updatableClonein classAbstractArray- Parameters:
memoryModel- the memory model, used for allocation a new copy of this array.- Returns:
- an updatable copy of this array.
- See Also:
-
ja
Description copied from class:AbstractArrayThis implementation performs the following code:return this instanceof DirectAccessible da && da.hasJavaArray() && da.javaArrayOffset() == 0 && java.lang.reflect.Array.getLength(da.javaArray()) == this.length() ? da.javaArray() : Arrays.toJavaArray(this);- Specified by:
jain interfaceArray- Specified by:
jain interfaceObjectArray<E>- Overrides:
jain classAbstractArray- Returns:
- Java array, equivalent to this AlgART array.
- See Also:
-
loadResources
This implementation callsloadResources(context, 0, length()).- Specified by:
loadResourcesin interfaceArray- Overrides:
loadResourcesin classAbstractArray- Parameters:
context- the context of execution; may be null, then it will be ignored.- See Also:
-
flushResources
This implementation callsflushResources(context, 0, length(), forcePhysicalWriting).- Specified by:
flushResourcesin interfaceArray- Overrides:
flushResourcesin classAbstractArray- Parameters:
context- 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.- See Also:
-
freeResources
This implementation callsfreeResources(context, 0, length()), forcePhysicalWriting).- Specified by:
freeResourcesin interfaceArray- Overrides:
freeResourcesin classAbstractArray- Parameters:
context- 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.- See Also:
-
loadResources
This method implements all actions that should be performed by call. This default implementation callssubArray(fromIndex, toIndex).loadResources(context)loadResources(c)(where c is a necessarypartof 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.- Parameters:
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.- Throws:
IndexOutOfBoundsException- for illegal fromIndex and toIndex (fromIndex < 0 || toIndex > length() || fromIndex > toIndex).
-
flushResources
protected void flushResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting) This method implements all actions that should be performed by call. This default implementation callssubArray(fromIndex, toIndex).flushResources(context, forcePhysicalWriting)flushResources(c, forcePhysicalWriting)(where c is a necessarypartof 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 (alikeAbstractArray.flushResources(ArrayContext, boolean)).- Parameters:
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.- Throws:
IndexOutOfBoundsException- for illegal fromIndex and toIndex (fromIndex < 0 || toIndex > length() || fromIndex > toIndex).
-
freeResources
protected void freeResources(ArrayContext context, long fromIndex, long toIndex, boolean forcePhysicalWriting) This method implements all actions that should be performed by call. This default implementation callssubArray(fromIndex, toIndex).freeResources(context, forcePhysicalWriting)freeResources(c, forcePhysicalWriting)(where c is a necessarypartof 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 (alikeAbstractArray.freeResources(ArrayContext, boolean)).- Parameters:
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.- Throws:
IndexOutOfBoundsException- for illegal fromIndex and toIndex (fromIndex < 0 || toIndex > length() || fromIndex > toIndex).
-
toString
Description copied from interface:ArrayReturns a brief string description of this object.The 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 useArrays.toString(CharArray)method.- Specified by:
toStringin interfaceArray- Specified by:
toStringin classAbstractArray- Returns:
- a brief string description of this object.
-