AlgART Home

net.algart.arrays
Class SimpleMemoryModel

java.lang.Object
  extended by net.algart.arrays.AbstractMemoryModel
      extended by net.algart.arrays.SimpleMemoryModel
All Implemented Interfaces:
MemoryModel

public final class SimpleMemoryModel
extends AbstractMemoryModel

The simplest memory model, based on usual Java arrays. It means that AlgART array of elements of some type contains an underlying Java array type[], and any access to AlgART array elements is translated to corresponding access to the underlying Java array. The only exception is bit arrays, where the bits are packed into long[] Java array, as specified in PackedBitArrays class.

This memory model supports all possible element types. The maximal theoretical limit for length and capacity of AlgART arrays, supported by this memory model, is 237-64 for bit arrays and 231-1 for all other element types. The real limit is essentially less, usually 2 GB in 64-bit JVM or ~1.0-1.5 GB in 32-bit JVM.

This memory model may be not effective enough for very large arrays of non-primitive elements (inheritors of Object class): it stores them as array of pointers, alike standard ArrayList. For effective storing arrays of objects, we recommend using the combined memory model.

All arrays created by this memory model, besides bit arrays and immutable views of the arrays, implement DirectAccessible interface, and DirectAccessible.hasJavaArray() returns true for such arrays.

All arrays, created by this memory model, have empty implementation of Array.loadResources(ArrayContext), Array.flushResources(ArrayContext), Array.flushResources(ArrayContext, boolean) and Array.freeResources(ArrayContext) methods: these methods do nothing.

In the arrays of objects (non-primitive) created by this memory model:

This class is immutable and thread-safe: there are no ways to modify settings of its instance returned by getInstance() method. Moreover, it is a singleton: getInstance() always returns the same object.

AlgART Laboratory 2007-2013

Since:
JDK 1.5
Version:
1.2
Author:
Daniel Alievsky

Method Summary
Modifier and Type Method and Description
 boolean areAllElementTypesSupported()
          Returns true if this memory model can create arrays with all element types.
 boolean areAllPrimitiveElementTypesSupported()
          Returns true if this memory model can create arrays with all primitive element types: boolean, char, byte, short, int, long, float, double.
static UpdatableArray asUpdatableArray(java.lang.Object array)
          Returns an unresizable AlgART array backed by the specified Java array, excluding a case of boolean[] array.
static UpdatableByteArray asUpdatableByteArray(byte[] array)
          Equivalent to (UpdatableByteArray)asUpdatableArray((Object)array).
static UpdatableCharArray asUpdatableCharArray(char[] array)
          Equivalent to (UpdatableCharArray)asUpdatableArray((Object)array).
static UpdatableDoubleArray asUpdatableDoubleArray(double[] array)
          Equivalent to (UpdatableDoubleArray)asUpdatableArray((Object)array).
static UpdatableFloatArray asUpdatableFloatArray(float[] array)
          Equivalent to (UpdatableFloatArray)asUpdatableArray((Object)array).
static UpdatableIntArray asUpdatableIntArray(int[] array)
          Equivalent to (UpdatableIntArray)asUpdatableArray((Object)array).
static UpdatableLongArray asUpdatableLongArray(long[] array)
          Equivalent to (UpdatableLongArray)asUpdatableArray((Object)array).
static
<E> UpdatableObjectArray<E>
asUpdatableObjectArray(E[] array)
          Equivalent to (UpdatableObjectArray)asUpdatableArray((Object)array).
static UpdatableShortArray asUpdatableShortArray(short[] array)
          Equivalent to (UpdatableShortArray)asUpdatableArray((Object)array).
static SimpleMemoryModel getInstance()
          Returns an instance of this memory model.
 boolean isCreatedBy(Array array)
          Returns true if the passed array was created by this (or identical) memory model.
 boolean isElementTypeSupported(java.lang.Class<?> elementType)
          Returns true if this memory model can create arrays with this element type.
static boolean isSimpleArray(Array array)
          Returns true if the passed instance is an array created by this memory model.
 long maxSupportedLength(java.lang.Class<?> elementType)
          This implementation returns Integer.MAX_VALUE == 231-1 for all element types besides boolean.class, or some large value (depending on implementation) for boolean.class.
 MutableArray newArray(java.lang.Class<?> elementType, long initialLength)
          Constructs a zero-filled resizable array with the specified element type and initial length.
 MutableArray newEmptyArray(java.lang.Class<?> elementType)
          Constructs an empty resizable array with the specified element type and a little initial capacity.
 MutableArray newEmptyArray(java.lang.Class<?> elementType, long initialCapacity)
          Constructs an empty resizable array with the specified element type and initial capacity.
 UpdatableArray newUnresizableArray(java.lang.Class<?> elementType, long length)
          Constructs a zero-filled unresizable array with the specified element type and length.
 java.lang.String toString()
          Returns a brief string description of this memory model.
 UpdatableBitArray valueOf(boolean[] array)
          Equivalent to (UpdatableBitArray)valueOf((Object)array).
 UpdatableBitArray valueOf(boolean[] array, int offset, int count)
          Equivalent to (UpdatableBitArray)valueOf((Object)array, offset, count).
 UpdatableByteArray valueOf(byte[] array)
          Equivalent to (UpdatableByteArray)valueOf((Object)array).
 UpdatableByteArray valueOf(byte[] array, int offset, int count)
          Equivalent to (UpdatableByteArray)valueOf((Object)array, offset, count).
 UpdatableCharArray valueOf(char[] array)
          Equivalent to (UpdatableCharArray)valueOf((Object)array).
 UpdatableCharArray valueOf(char[] array, int offset, int count)
          Equivalent to (UpdatableCharArray)valueOf((Object)array, offset, count).
 UpdatableDoubleArray valueOf(double[] array)
          Equivalent to (UpdatableDoubleArray)valueOf((Object)array).
 UpdatableDoubleArray valueOf(double[] array, int offset, int count)
          Equivalent to (UpdatableDoubleArray)valueOf((Object)array, offset, count).
 UpdatableFloatArray valueOf(float[] array)
          Equivalent to (UpdatableFloatArray)valueOf((Object)array).
 UpdatableFloatArray valueOf(float[] array, int offset, int count)
          Equivalent to (UpdatableFloatArray)valueOf((Object)array, offset, count).
 UpdatableIntArray valueOf(int[] array)
          Equivalent to (UpdatableIntArray)valueOf((Object)array).
 UpdatableIntArray valueOf(int[] array, int offset, int count)
          Equivalent to (UpdatableIntArray)valueOf((Object)array, offset, count).
 UpdatableLongArray valueOf(long[] array)
          Equivalent to (UpdatableLongArray)valueOf((Object)array).
 UpdatableLongArray valueOf(long[] array, int offset, int count)
          Equivalent to (UpdatableLongArray)valueOf((Object)array, offset, count).
 UpdatableArray valueOf(java.lang.Object array)
          Constructs an unresizable AlgART array containing all elements of the specified Java array: array[0], array[1], ..., array[array.length - 1].
 UpdatableArray valueOf(java.lang.Object array, int offset, int count)
          Constructs an unresizable AlgART array containing count elements of the specified Java array: array[offset], array[offset + 1], ..., array[offset + count - 1].
 UpdatableShortArray valueOf(short[] array)
          Equivalent to (UpdatableShortArray)valueOf((Object)array).
 UpdatableShortArray valueOf(short[] array, int offset, int count)
          Equivalent to (UpdatableShortArray)valueOf((Object)array, offset, count).
 
Methods inherited from class net.algart.arrays.AbstractMemoryModel
newArray, newBitArray, newBitMatrix, newByteArray, newByteMatrix, newCharArray, newCharMatrix, newDoubleArray, newDoubleMatrix, newEmptyBitArray, newEmptyBitArray, newEmptyByteArray, newEmptyByteArray, newEmptyCharArray, newEmptyCharArray, newEmptyDoubleArray, newEmptyDoubleArray, newEmptyFloatArray, newEmptyFloatArray, newEmptyIntArray, newEmptyIntArray, newEmptyLongArray, newEmptyLongArray, newEmptyObjectArray, newEmptyObjectArray, newEmptyShortArray, newEmptyShortArray, newFloatArray, newFloatMatrix, newIntArray, newIntMatrix, newLazyCopy, newLazyCopy, newLongArray, newLongMatrix, newMatrix, newMatrix, newMatrix, newObjectArray, newObjectMatrix, newShortArray, newShortMatrix, newStructuredMatrix, newUnresizableArray, newUnresizableBitArray, newUnresizableByteArray, newUnresizableCharArray, newUnresizableDoubleArray, newUnresizableFloatArray, newUnresizableIntArray, newUnresizableLazyCopy, newUnresizableLongArray, newUnresizableObjectArray, newUnresizableShortArray, valueOf, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static SimpleMemoryModel getInstance()
Returns an instance of this memory model. This method always returns the same object.

Returns:
an instance of this memory model.
See Also:
Arrays.SMM

newEmptyArray

public MutableArray newEmptyArray(java.lang.Class<?> elementType)
Description copied from interface: MemoryModel
Constructs an empty resizable array with the specified element type and a little initial capacity. It is equivalent to newEmptyArray(elementType, n), where n is some little value.

Example of usage:

     MutableFloatArray a = (MutableFloatArray)memoryModel.newEmptyArray(float.class);
 

Specified by:
newEmptyArray in interface MemoryModel
Specified by:
newEmptyArray in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
Returns:
created AlgART array.
See Also:
MemoryModel.isElementTypeSupported(Class), MemoryModel.newArray(Class, long)

newEmptyArray

public MutableArray newEmptyArray(java.lang.Class<?> elementType,
                                  long initialCapacity)
Description copied from interface: MemoryModel
Constructs an empty resizable array with the specified element type and initial capacity.

The element type can be either usual object class (as String.class), or one of the primitive types: boolean.class, byte.class, short.class, int.class, long.class, float.class, double.class, char.class. The element type cannot be void.class.

In a case of primitive types, the created array will implement the corresponding interface BitArray, ByteArray, ShortArray, IntArray, LongArray, FloatArray, DoubleArray or CharArray. In this case, the created array (unlike standard ArrayList) will occupy the same amount of memory as the Java array boolean[initialCapacity], byte[initialCapacity], etc.

In a case of non-primitive types (Object inheritors), the created array will implement the MutableObjectArray interface.

Some element type may be not supported by this memory model. For example, some memory models may support only primitive types, or only one concrete type. In such a case, UnsupportedElementTypeException will be thrown.

Some too large array capacities may be not supported by this memory model. For example, SimpleMemoryModel does not support arrays larger than 0x7FFFFFFF (Integer.MAX_VALUE) elements.

Example of usage:

     MutableFloatArray a = (MutableFloatArray)memoryModel.newEmptyArray(float.class, 10000);
 

Specified by:
newEmptyArray in interface MemoryModel
Specified by:
newEmptyArray in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
initialCapacity - the initial capacity of the array.
Returns:
created AlgART array.
See Also:
MemoryModel.isElementTypeSupported(Class), MemoryModel.newArray(Class, long)

newArray

public MutableArray newArray(java.lang.Class<?> elementType,
                             long initialLength)
Description copied from interface: MemoryModel
Constructs a zero-filled resizable array with the specified element type and initial length. The capacity of new array will be equal to its length.

This method is equivalent to the following call: newEmptyArray(elementType, initialLength).length(initialLength).trim().

Specified by:
newArray in interface MemoryModel
Specified by:
newArray in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
initialLength - the initial length and capacity of the array.
Returns:
created AlgART array.
See Also:
MemoryModel.isElementTypeSupported(Class), MemoryModel.newEmptyArray(Class, long), MemoryModel.newUnresizableArray(Class, long)

newUnresizableArray

public UpdatableArray newUnresizableArray(java.lang.Class<?> elementType,
                                          long length)
Description copied from interface: MemoryModel
Constructs a zero-filled unresizable array with the specified element type and length. The capacity of new array will be equal to its length.

The analogous result may be obtained the following call: newArray(elementType, length).asUnresizable(). However, we don't recommend to use such code. If you are sure that you will not need to change the array length, please always use this method (or newUnresizableBitArray, newUnresizableBteArray, etc.). In some memory models, creating resizable array with the given length may require much more resources that creating unresizable one. For example, in the large memory model every resizable array is stored in the file consisting of integer number of blocks per DataFileModel.recommendedBankSize(true) bytes.

Specified by:
newUnresizableArray in interface MemoryModel
Specified by:
newUnresizableArray in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
length - the length and capacity of the array.
Returns:
created unresizable AlgART array.
See Also:
MemoryModel.isElementTypeSupported(Class), MemoryModel.newArray(Class, long)

valueOf

public UpdatableArray valueOf(java.lang.Object array,
                              int offset,
                              int count)
Description copied from interface: MemoryModel
Constructs an unresizable AlgART array containing count elements of the specified Java array: array[offset], array[offset + 1], ..., array[offset + count - 1].

The returned AlgART array will be "safe" in that no references to the passed Java array are maintained by it. In other words, this method must always allocate a new AlgART array.

This method is equivalent to the following expression: newUnresizableArray(elementType, count).setData(0, array, offset, count), where elementType is the type of array elements (array.getClass().getComponentType()).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableArray valueOf(java.lang.Object array)
Description copied from interface: MemoryModel
Constructs an unresizable AlgART array containing all elements of the specified Java array: array[0], array[1], ..., array[array.length - 1].

The returned AlgART array will be "safe" in that no references to the passed Java array are maintained by it. In other words, this method must always allocate a new array.

This method is equivalent to the following expression: newUnresizableArray(elementType, len).setData(0, array), where elementType is the type of array elements (array.getClass().getComponentType()) and len is the length of the passed Java array.

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableBitArray valueOf(boolean[] array,
                                 int offset,
                                 int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableBitArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableBitArray valueOf(boolean[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableBitArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableCharArray valueOf(char[] array,
                                  int offset,
                                  int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableCharArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableCharArray valueOf(char[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableCharArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableByteArray valueOf(byte[] array,
                                  int offset,
                                  int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableByteArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableByteArray valueOf(byte[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableByteArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableShortArray valueOf(short[] array,
                                   int offset,
                                   int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableShortArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableShortArray valueOf(short[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableShortArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableIntArray valueOf(int[] array,
                                 int offset,
                                 int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableIntArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableIntArray valueOf(int[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableIntArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableLongArray valueOf(long[] array,
                                  int offset,
                                  int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableLongArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableLongArray valueOf(long[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableLongArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableFloatArray valueOf(float[] array,
                                   int offset,
                                   int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableFloatArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableFloatArray valueOf(float[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableFloatArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableDoubleArray valueOf(double[] array,
                                    int offset,
                                    int count)
Description copied from interface: MemoryModel
Equivalent to (UpdatableDoubleArray)valueOf((Object)array, offset, count).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
offset - starting position in the source Java array.
count - the length of returned AlgART array.
Returns:
created unresizable AlgART array.

valueOf

public UpdatableDoubleArray valueOf(double[] array)
Description copied from interface: MemoryModel
Equivalent to (UpdatableDoubleArray)valueOf((Object)array).

Specified by:
valueOf in interface MemoryModel
Overrides:
valueOf in class AbstractMemoryModel
Parameters:
array - the source Java array with elements of constructed AlgART array.
Returns:
created unresizable AlgART array.

isElementTypeSupported

public boolean isElementTypeSupported(java.lang.Class<?> elementType)
Description copied from interface: MemoryModel
Returns true if this memory model can create arrays with this element type. If it does not support it, creation methods of this memory model will throw UnsupportedElementTypeException. The result is not defined for void.class.

Specified by:
isElementTypeSupported in interface MemoryModel
Specified by:
isElementTypeSupported in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
Returns:
true if this memory model supports this element type.

areAllPrimitiveElementTypesSupported

public boolean areAllPrimitiveElementTypesSupported()
Description copied from interface: MemoryModel
Returns true if this memory model can create arrays with all primitive element types: boolean, char, byte, short, int, long, float, double.

Specified by:
areAllPrimitiveElementTypesSupported in interface MemoryModel
Specified by:
areAllPrimitiveElementTypesSupported in class AbstractMemoryModel
Returns:
true if this memory model supports all primitive element types.
See Also:
MemoryModel.isElementTypeSupported(Class)

areAllElementTypesSupported

public boolean areAllElementTypesSupported()
Description copied from interface: MemoryModel
Returns true if this memory model can create arrays with all element types. This package offers only one such memory model: SimpleMemoryModel.

Specified by:
areAllElementTypesSupported in interface MemoryModel
Specified by:
areAllElementTypesSupported in class AbstractMemoryModel
Returns:
true if this memory model supports element types.
See Also:
MemoryModel.isElementTypeSupported(Class)

maxSupportedLength

public long maxSupportedLength(java.lang.Class<?> elementType)
This implementation returns Integer.MAX_VALUE == 231-1 for all element types besides boolean.class, or some large value (depending on implementation) for boolean.class.

In current implementation, returns 237-64 for boolean.class, because bits are stored in long values.

Specified by:
maxSupportedLength in interface MemoryModel
Specified by:
maxSupportedLength in class AbstractMemoryModel
Parameters:
elementType - the type of array elements.
Returns:
maximal possible length of arrays supported by this memory model.
Throws:
java.lang.NullPointerException - if elementType is null.

isCreatedBy

public boolean isCreatedBy(Array array)
Description copied from interface: MemoryModel
Returns true if the passed array was created by this (or identical) memory model.

For SimpleMemoryModel and BufferMemoryModel, "identical" means the same memory model.

For LargeMemoryModel, "identical" means that the memory model is also large and was created with the same instance of the data file factory.

For CombinedMemoryModel, "identical" means that the memory model is also combined and was created with the same instance of the combiner.

Returns false if the passed argument is null.

Specified by:
isCreatedBy in interface MemoryModel
Specified by:
isCreatedBy in class AbstractMemoryModel
Parameters:
array - the AlgART array (may be null, than the method returns false).
Returns:
true if the passed array was created by this memory model.

isSimpleArray

public static boolean isSimpleArray(Array array)
Returns true if the passed instance is an array created by this memory model. Returns false if the passed array is null or an AlgART array created by another memory model.

As this memory model is a singleton, this method is equivalent to isCreatedBy(Array).

Parameters:
array - the checked array.
Returns:
true if this array is created by the simple memory model.

toString

public java.lang.String toString()
Returns a brief string description of this memory model.

The result of this method may depend on implementation.

Overrides:
toString in class java.lang.Object
Returns:
a brief string description of this object.

asUpdatableArray

public static UpdatableArray asUpdatableArray(java.lang.Object array)
Returns an unresizable AlgART array backed by the specified Java array, excluding a case of boolean[] array. The result AlgART array contains all elements the passed Java array: array[0], array[1], ..., array[array.length - 1], and changes in the returned array "write through" to array argument. The length and capacity of the returned array are equal to array.length.

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.
java.lang.IllegalArgumentException - if array argument is not an array or boolean[] array.

asUpdatableCharArray

public static UpdatableCharArray asUpdatableCharArray(char[] array)
Equivalent to (UpdatableCharArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableByteArray

public static UpdatableByteArray asUpdatableByteArray(byte[] array)
Equivalent to (UpdatableByteArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableShortArray

public static UpdatableShortArray asUpdatableShortArray(short[] array)
Equivalent to (UpdatableShortArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableIntArray

public static UpdatableIntArray asUpdatableIntArray(int[] array)
Equivalent to (UpdatableIntArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableLongArray

public static UpdatableLongArray asUpdatableLongArray(long[] array)
Equivalent to (UpdatableLongArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableFloatArray

public static UpdatableFloatArray asUpdatableFloatArray(float[] array)
Equivalent to (UpdatableFloatArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableDoubleArray

public static UpdatableDoubleArray asUpdatableDoubleArray(double[] array)
Equivalent to (UpdatableDoubleArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.

asUpdatableObjectArray

public static <E> UpdatableObjectArray<E> asUpdatableObjectArray(E[] array)
Equivalent to (UpdatableObjectArray)asUpdatableArray((Object)array).

Parameters:
array - the source Java array.
Returns:
an unresizable AlgART array backed by the specified Java array.
Throws:
java.lang.NullPointerException - if array argument is null.