public class PrimitiveDoubleArray extends AbstractPrimitiveArray
Constructor and Description |
---|
PrimitiveDoubleArray()
Default constructor
|
PrimitiveDoubleArray(PrimitiveDoubleArray sourceArray)
Copying constructor
|
Modifier and Type | Method and Description |
---|---|
double[] |
asArray()
Get a reference to a double[] that represents the contents of this array.
|
static <A extends PrimitiveDoubleArray> |
copyInstance(A source)
Create a new <A extends
PrimitiveDoubleArray > instance, using a copy constructor to
replicate the contents of the given source array |
static <A extends PrimitiveDoubleArray> |
copyInstance(java.lang.invoke.MethodHandles.Lookup lookup,
A source)
Create a new <A extends
PrimitiveDoubleArray > instance, using a copy constructor to
replicate the contents of the given source array |
double |
get(int index)
Get the value of an element in the array.
|
double |
get(long index)
Get the value of an element in the array.
|
long |
getLength()
Get the length of the array
|
static <A extends PrimitiveDoubleArray> |
newInstance(java.lang.Class<A> arrayClass,
long length)
Create a new instance of <A extends
PrimitiveDoubleArray > with a given length. |
static <A extends PrimitiveDoubleArray> |
newInstance(CtorAndArgs<A> arrayCtorAndArgs,
long length)
Create a new instance of <A extends
PrimitiveDoubleArray > with a given length,
array constructor, and array constructor arguments. |
static PrimitiveDoubleArray |
newInstance(long length)
Create a new instance of
PrimitiveDoubleArray with a given length. |
static <A extends PrimitiveDoubleArray> |
newInstance(long length,
java.lang.reflect.Constructor<A> arrayConstructor,
java.lang.Object... arrayConstructorArgs)
Create a new instance of <A extends
PrimitiveDoubleArray > with a given length,
array constructor, and array constructor arguments. |
static <A extends PrimitiveDoubleArray> |
newInstance(java.lang.invoke.MethodHandles.Lookup lookup,
java.lang.Class<A> arrayClass,
long length)
Create a new instance of <A extends
PrimitiveDoubleArray > with a given length. |
void |
set(int index,
double value)
set the value of an element in the array.
|
void |
set(long index,
double value)
set the value of an element in the array.
|
public PrimitiveDoubleArray()
public PrimitiveDoubleArray(PrimitiveDoubleArray sourceArray)
sourceArray
- the array to copypublic double[] asArray() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if array is too long to represent as a double[]public long getLength()
public double get(int index)
index
- the index of the elementpublic double get(long index)
index
- the index of the elementpublic void set(int index, double value)
index
- the index of the element to setvalue
- the value to assign to the elementpublic void set(long index, double value)
index
- the index of the element to setvalue
- the value to assign to the elementpublic static PrimitiveDoubleArray newInstance(long length)
PrimitiveDoubleArray
with a given length.length
- the length of the array.PrimitiveDoubleArray
with the given lengthpublic static <A extends PrimitiveDoubleArray> A newInstance(java.lang.Class<A> arrayClass, long length)
PrimitiveDoubleArray
> with a given length.A
- The class of the array to be created (extends PrimitiveDoubleArray)arrayClass
- The class of the array to be created (extends PrimitiveDoubleArray)length
- the length of the array.PrimitiveDoubleArray
> with a given lengthpublic static <A extends PrimitiveDoubleArray> A newInstance(java.lang.invoke.MethodHandles.Lookup lookup, java.lang.Class<A> arrayClass, long length)
PrimitiveDoubleArray
> with a given length.A
- The class of the array to be created (extends PrimitiveDoubleArray)lookup
- The lookup object to use for accessing the array's constructorarrayClass
- The class of the array to be created (extends PrimitiveDoubleArray)length
- the length of the array.PrimitiveDoubleArray
> with a given lengthpublic static <A extends PrimitiveDoubleArray> A newInstance(CtorAndArgs<A> arrayCtorAndArgs, long length)
PrimitiveDoubleArray
> with a given length,
array constructor, and array constructor arguments.A
- The class of the array to be created (extends PrimitiveDoubleArray)length
- The length of the array.arrayCtorAndArgs
- for creating the arrayPrimitiveDoubleArray
>public static <A extends PrimitiveDoubleArray> A newInstance(long length, java.lang.reflect.Constructor<A> arrayConstructor, java.lang.Object... arrayConstructorArgs)
PrimitiveDoubleArray
> with a given length,
array constructor, and array constructor arguments.A
- The class of the array to be created (extends PrimitiveDoubleArray)length
- The length of the array.arrayConstructor
- The array constructor to usearrayConstructorArgs
- The arguments to pass to the array constructorPrimitiveDoubleArray
>public static <A extends PrimitiveDoubleArray> A copyInstance(A source) throws java.lang.NoSuchMethodException
PrimitiveDoubleArray
> instance, using a copy constructor to
replicate the contents of the given source arrayA
- The class of the array to be created (extends PrimitiveDoubleArray)source
- The array to replicatePrimitiveDoubleArray
> copied from the source arrayjava.lang.NoSuchMethodException
- if <A> does not have a copy constructorpublic static <A extends PrimitiveDoubleArray> A copyInstance(java.lang.invoke.MethodHandles.Lookup lookup, A source) throws java.lang.NoSuchMethodException
PrimitiveDoubleArray
> instance, using a copy constructor to
replicate the contents of the given source arrayA
- The class of the array to be created (extends PrimitiveDoubleArray)lookup
- The lookup object to use for accessing the array's constructorsource
- The array to replicatePrimitiveDoubleArray
> copied from the source arrayjava.lang.NoSuchMethodException
- if <A> does not have a copy constructor