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
ModifierConstructorDescriptionprotected
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.protected
AbstractObjectArray
(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 type
is not its subclass).void
This implementation does nothing.Returns the type of array elements.void
flushResources
(ArrayContext context, boolean forcePhysicalWriting) This implementation callsflushResources(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 call.subArray
(fromIndex, toIndex).flushResources(context, forcePhysicalWriting)
void
freeResources
(ArrayContext context, boolean forcePhysicalWriting) This implementation callsfreeResources(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 call.subArray
(fromIndex, toIndex).freeResources(context, forcePhysicalWriting)
abstract E
get
(long index) Equivalent togetElement(index)
.void
This implementation callsgetData(long, Object, int, int)
with corresponding arguments.void
This implementation is based on a loop of calls ofget(long)
method.getElement
(long index) This implementation returns get(index).long
This implementation is based on a loop of calls ofget(long)
method from index max(lowIndex,0) until index min(AbstractArray.length()
,highIndex)-1.boolean
This implementation returns false.boolean
This implementation returns true.boolean
This implementation returns true.E[]
ja()
This implementation performs the following code:long
lastIndexOf
(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).void
loadResources
(ArrayContext context) This implementation callsloadResources(context, 0, length())
.protected void
loadResources
(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 ofAbstractObjectArray
with 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, subArr
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.algart.arrays.Array
byteOrder, capacity, equals, flushResources, freeResources, hashCode, isEmpty, isLazy, isNew, isNewReadOnlyView, length, length32, newJavaArray, shallowClone, subArr
Methods 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 correspondingsubarrays
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)
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
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 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 type
of 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 type
of 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:Array
Returns 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:
elementType
in interfaceArray
- Specified by:
elementType
in interfaceObjectArray<E>
- Specified by:
elementType
in classAbstractArray
- Returns:
- the type of array elements.
- See Also:
- boolean.class for
-
type
Description copied from interface:Array
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. 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:
type
in interfaceArray
- Specified by:
type
in interfaceObjectArray<E>
- Specified by:
type
in classAbstractArray
- Returns:
- canonical AlgART type of this array.
-
updatableType
Description copied from interface:Array
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. 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:
updatableType
in interfaceArray
- Specified by:
updatableType
in interfaceObjectArray<E>
- Specified by:
updatableType
in classAbstractArray
- Returns:
- canonical AlgART type of an updatable array of the same kind.
-
mutableType
Description copied from interface:Array
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. 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:
mutableType
in interfaceArray
- Specified by:
mutableType
in interfaceObjectArray<E>
- Specified by:
mutableType
in 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:
getData
in interfaceArray
- Specified by:
getData
in 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:
getData
in interfaceArray
- Specified by:
getData
in 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:
getElement
in interfaceArray
- Specified by:
getElement
in 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:ObjectArray
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 type
is 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 type
and do not allow saving illegal elements.- Specified by:
cast
in interfaceObjectArray<E>
- Parameters:
elementType
- the required generic type.- Returns:
- this array cast to the specified generic element type.
-
subArray
This implementation returns new instance ofAbstractObjectArray
with 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:
subArray
in interfaceArray
- Specified by:
subArray
in 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:AbstractArray
This 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 implementsDirectAccessible
interface and itshasJavaArray()
method returns true, or it is a bit array created by thesimple memory model
.- Specified by:
buffer
in interfaceArray
- Specified by:
buffer
in interfaceObjectArray<E>
- Overrides:
buffer
in 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:AbstractArray
This implementation returnsbuffer(mode, someCapacity)
, where mode is the argument of this method and someCapacity is the result ofdefaultBufferCapacity(thisArray)
method.- Specified by:
buffer
in interfaceArray
- Specified by:
buffer
in interfaceObjectArray<E>
- Overrides:
buffer
in classAbstractArray
- Parameters:
mode
- the access mode for new buffer.- Returns:
- new data buffer for accessing this array.
-
buffer
Description copied from class:AbstractArray
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.- Specified by:
buffer
in interfaceArray
- Specified by:
buffer
in interfaceObjectArray<E>
- Overrides:
buffer
in classAbstractArray
- Parameters:
capacity
- the capacity of the buffer.- Returns:
- new data buffer for accessing this array.
-
buffer
Description copied from class:AbstractArray
This implementation returnsbuffer(suitableMode)
, where suitableMode is this instanceof UpdatableArray ? DataBuffer.AccessMode.READ_WRITE : DataBuffer.AccessMode.READ.- Specified by:
buffer
in interfaceArray
- Specified by:
buffer
in interfaceObjectArray<E>
- Overrides:
buffer
in classAbstractArray
- Returns:
- new data buffer for accessing this array.
-
get
Description copied from interface:ObjectArray
Equivalent togetElement(index)
.- Specified by:
get
in 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:
indexOf
in 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:
lastIndexOf
in 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:
isImmutable
in interfaceArray
- Specified by:
isImmutable
in 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:
isUnresizable
in interfaceArray
- Specified by:
isUnresizable
in classAbstractArray
- Returns:
- true if this instance is unresizable.
- See Also:
-
checkUnallowedMutation
This implementation does nothing.- Specified by:
checkUnallowedMutation
in interfaceArray
- Specified by:
checkUnallowedMutation
in classAbstractArray
- Throws:
UnallowedMutationError
- never in this implementation.- See Also:
-
asTrustedImmutable
This implementation callsasImmutable()
and returns its result.- Specified by:
asTrustedImmutable
in interfaceArray
- Specified by:
asTrustedImmutable
in interfaceObjectArray<E>
- Specified by:
asTrustedImmutable
in 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:
asCopyOnNextWrite
in interfaceArray
- Specified by:
asCopyOnNextWrite
in 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:
isCopyOnNextWrite
in interfaceArray
- Specified by:
isCopyOnNextWrite
in 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:
asImmutable
in interfaceArray
- Specified by:
asImmutable
in interfaceObjectArray<E>
- Specified by:
asImmutable
in 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:
mutableClone
in interfaceArray
- Specified by:
mutableClone
in interfaceObjectArray<E>
- Overrides:
mutableClone
in 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:AbstractArray
This implementation performs the following: memoryModel.newUnresizableArray
(thisArray).copy
(thisArray).- Specified by:
updatableClone
in interfaceArray
- Specified by:
updatableClone
in interfaceObjectArray<E>
- Overrides:
updatableClone
in 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:AbstractArray
This 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:
ja
in interfaceArray
- Specified by:
ja
in interfaceObjectArray<E>
- Overrides:
ja
in classAbstractArray
- Returns:
- Java array, equivalent to this AlgART array.
- See Also:
-
loadResources
This implementation callsloadResources(context, 0, length())
.- Specified by:
loadResources
in interfaceArray
- Overrides:
loadResources
in 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:
flushResources
in interfaceArray
- Overrides:
flushResources
in 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:
freeResources
in interfaceArray
- Overrides:
freeResources
in 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 necessarypart
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.- 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 necessarypart
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 (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 necessarypart
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 (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:Array
Returns 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:
toString
in interfaceArray
- Specified by:
toString
in classAbstractArray
- Returns:
- a brief string description of this object.
-