org.das2.qds.ArrayDataSet

ArrayDataSet is the abstract base class for QDataSets which are backed by Java arrays For example, DDataSet is a QDataSet which uses a double array to store its data. Data is stored in 1-D Java arrays for performance, inspired by https://www.cs.cmu.edu/~artigas/papers/cacm01.pdf. Note for modern versions of Java, Arrays of Arrays are implemented with no performance cost. A number of static methods were initially defined in DDataSet, then copied into FDataSet and others when they were made. This super implementation will parent all such datasets and provide common methods.


about

about( ) → void

print some info about this ArrayDataSet.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


append

append( org.das2.qds.ArrayDataSet ds ) → void

append the dataset with the same geometry but different number of records (zeroth dim) to this. An IllegalArgumentException is thrown when there is not enough room. See grow(newRecCount). Not thread safe--we need to go through and make it so...

Parameters

ds - an ArrayDataSet

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


append

append( org.das2.qds.ArrayDataSet ds1, org.das2.qds.ArrayDataSet ds2 ) → org.das2.qds.ArrayDataSet

append the second dataset onto this dataset. The two datasets need only have convertible units, so for example two time arrays may be appended even if their units don't have the same base, and the times will be converted. Only properties of the two datasets that do not change are preserved. When two rank 0 datasets are appended, the result will be rank 1.

Parameters

ds1 - rank N dataset
ds2 - rank N dataset of the same type and compatible geometry as ds1.

Returns:

dataset with the data appended.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


canAppend

canAppend( org.das2.qds.ArrayDataSet ds ) → boolean

return true if the dataset can be appended. Note this assumes that the same length, etc. This just checks that we have the number of spare records in the backing store.

Parameters

ds - the dataset to test

Returns:

true if the dataset can be appended.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


copy

copy( QDataSet ds, org.das2.qds.LongReadAccess lra ) → org.das2.qds.ArrayDataSet

Parameters

ds - a QDataSet
lra - a LongReadAccess

Returns:

org.das2.qds.ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


copy

copy( java.lang.Class c, QDataSet ds ) → org.das2.qds.ArrayDataSet

Copy to array of specific type. For example, copy( double.class, ds ) would return a copy in a DDataSet.

Parameters

c - the primitive type to use (e.g. double.class, float.class, int.class).
ds - the data to copy.

Returns:

ArrayDataSet of specific type.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


copy

copy( QDataSet ds ) → org.das2.qds.ArrayDataSet

copies the dataset into a writable ArrayDataSet, and all of its depend datasets as well. Note this does not verify that the data is a qube!!!

Parameters

ds - the data to be copied.

Returns:

a copy of the data.

See Also:

guessBackingStore(QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


create

create( java.lang.Class c, int[] qube ) → org.das2.qds.ArrayDataSet

create a dataset with the backing type and the dimensions given. The following component types are supported: double.class, float.class, long.class, int.class, short.class, and byte.class.

Parameters

c - the backing type, such as double.class, float.class, etc.
qube - dimensions of the dataset

Returns:

the dataset

See Also:

getComponentType()
BufferDataSet which also supports unsigned types. which also supports unsigned types.


[search for examples] [view on GitHub] [view on old javadoc] [view source]


createRank0

createRank0( java.lang.Class c ) → org.das2.qds.ArrayDataSet

create a rank 0 dataset of the class, which can be double.class, float.class, long.class, int.class, short.class and byte.class

Parameters

c - the primitive class of each element.

Returns:

the ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


createRank1

createRank1( java.lang.Class c, int len0 ) → org.das2.qds.ArrayDataSet

create a rank 1 dataset of the class, which can be double.class, float.class, long.class, int.class, short.class and byte.class

Parameters

c - the primitive class of each element.
len0 - the length of the dimension

Returns:

the ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


createRank2

createRank2( java.lang.Class c, int len0, int len1 ) → org.das2.qds.ArrayDataSet

create a rank 2 dataset of the class, which can be double.class, float.class, long.class, int.class, short.class and byte.class

Parameters

c - the primitive class of each element.
len0 - the length of the dimension
len1 - the length of the dimension

Returns:

the ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


createRank3

createRank3( java.lang.Class c, int len0, int len1, int len2 ) → org.das2.qds.ArrayDataSet

create a rank 3 dataset of the class, which can be double.class, float.class, long.class, int.class, short.class and byte.class

Parameters

c - the primitive class of each element.
len0 - the length of the dimension
len1 - the length of the dimension
len2 - the length of the dimension

Returns:

the ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


createRank4

createRank4( java.lang.Class c, int len0, int len1, int len2, int len3 ) → org.das2.qds.ArrayDataSet

create a rank 4 dataset of the class, which can be double.class, float.class, long.class, int.class, short.class and byte.class

Parameters

c - the primitive class of each element.
len0 - the length of the dimension
len1 - the length of the dimension
len2 - the length of the dimension
len3 - the length of the dimension

Returns:

the ArrayDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]


flattenArray

flattenArray( Object array, int[] qube ) → Object

Parameters

array - an Object
qube - an int[]

Returns:

java.lang.Object

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getComponentType

getComponentType( ) → java.lang.Class

return the component type of the backing array, such as double.class.

Returns:

the component type of the backing array.

See Also:

create(java.lang.Class, int[])


[search for examples] [view on GitHub] [view on old javadoc] [view source]


grow

grow( int newRecCount ) → void

grow the internal store so that append may be used to resize the dataset.

Parameters

newRecCount - new number of records, which includes the old records.

Returns:

void (returns nothing)

See Also:

putLength(int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


guessBackingStore

guessBackingStore( QDataSet ds ) → java.lang.Class

guess the type of the backing store, returning double.class if it cannot be determined.

Parameters

ds - the dataset

Returns:

the backing store class, one of double.class, float.class, long.class, int.class, short.class, or byte.class.

See Also:

copy(QDataSet) copy


[search for examples] [view on GitHub] [view on old javadoc] [view source]


jvmMemory

jvmMemory( ) → int

returns the size of the dataset in bytes.

Returns:

the size of the dataset in bytes.

See Also:

org.das2.qds.buffer.BufferDataSet which stores data outside of the JVM. which stores data outside of the JVM.


[search for examples] [view on GitHub] [view on old javadoc] [view source]


length

length( ) → int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


length

length( int i ) → int

Parameters

i - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


length

length( int i0, int i1 ) → int

Parameters

i0 - an int
i1 - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


length

length( int i0, int i1, int i2 ) → int

Parameters

i0 - an int
i1 - an int
i2 - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


maybeCopy

maybeCopy( QDataSet ds ) → org.das2.qds.ArrayDataSet

Copy the dataset to an ArrayDataSet only if the dataset is not already an ArrayDataSet that is mutable.

Parameters

ds - the dataset to copy, which may be an ArrayDataSet

Returns:

an ArrayDataSet.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


maybeCopy

maybeCopy( java.lang.Class c, QDataSet ds ) → org.das2.qds.ArrayDataSet

Copy the dataset to a ArrayDataSet only if the dataset is not already a particular instance of the given type of ArrayDataSet.

Parameters

c - component type, e.g. float.class double.class int.class, etc.
ds - the dataset.

Returns:

ArrayDayaSet of component type c, e.g. double.class, float.class, etc.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


monotonicSubset

monotonicSubset( org.das2.qds.ArrayDataSet ds ) → org.das2.qds.ArrayDataSet

ensure that there are no non-monotonic or repeat records, by removing the first N-1 records of N repeated records.

Parameters

ds - ArrayDataSet, which must be writable.

Returns:

dataset, possibly with records removed.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


monotonicSubset2

monotonicSubset2( org.das2.qds.ArrayDataSet ds ) → org.das2.qds.ArrayDataSet

ensure that there are no non-monotonic or repeat records, by starting at the middle of the dataset and finding the monotonic subsection. The input need not be writable.

Parameters

ds - ArrayDataSet, which must be writable.

Returns:

dataset, possibly with records removed.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


putLength

putLength( int len ) → void

Shorten the dataset by changing it's dim 0 length parameter. The same backing array is used, so the element that remain will be the same. This can only be used to shorten datasets, see grow to lengthen.

Parameters

len - new number of records

Returns:

void (returns nothing)

See Also:

grow(int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


rank

rank( ) → int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setUnits

setUnits( Units units ) → QDataSet

set the units for this dataset. This is a convenience method intended to encourage setting the data units. For example in Jython:

ds= linspace(0.,10.,100).setUnits( Units.seconds )

Parameters

units - units object, like Units.seconds

Returns:

this dataset.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( ) → String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc] [view source]


wrap

wrap( Object array, int[] qube, boolean copy ) → org.das2.qds.ArrayDataSet

return the array as ArrayDataSet The array must be a 1-D array and the dimensions of the result are provided in qube.

Parameters

array - 1-D array
qube - dimensions of the dataset
copy - copy the data so that original data is not modified with putValue

Returns:

ArrayDataSet

See Also:

create(java.lang.Class, int[])


[search for examples] [view on GitHub] [view on old javadoc] [view source]