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( org.das2.qds.ArrayDataSet ds1, org.das2.qds.ArrayDataSet ds2 ) → ArrayDataSet

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 ) → 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( java.lang.Class c, QDataSet ds ) → ArrayDataSet
copy( QDataSet ds ) → ArrayDataSet

create

create( java.lang.Class c, int[][] qube ) → 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 ) → 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 ) → 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 ) → 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 ) → 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 ) → 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( ) → 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 ) → 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( int i ) → int
length( int i0, int i1 ) → int
length( int i0, int i1, int i2 ) → int

maybeCopy

maybeCopy( QDataSet ds ) → 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( java.lang.Class c, QDataSet ds ) → ArrayDataSet

monotonicSubset

monotonicSubset( org.das2.qds.ArrayDataSet ds ) → 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 ) → 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 ) → 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]