org.das2.qds.DataSetUtil

Utilities for QDataSet, such as conversions from various forms to QDataSet, and doing a units conversion. TODO: DataSetUtil, DataSetOps, and org.virbo.dsops.Ops have become blurred over the years. These should either be combined or new mission statements need to be created.


PROPERTY_TYPE_STRING


PROPERTY_TYPE_NUMBER


PROPERTY_TYPE_BOOLEAN


PROPERTY_TYPE_MAP


PROPERTY_TYPE_QDATASET


PROPERTY_TYPE_CACHETAG


PROPERTY_TYPE_UNITS


addContext

addContext( org.das2.qds.MutablePropertyDataSet ds, QDataSet cds ) → void

adds the rank 0 dataset (a Datum) to the dataset's properties, after all the other CONTEXT_<i> properties.

Parameters

ds -
cds -

Returns:

void (returns nothing)

search for examples view on GitHub view source


addQube

addQube( org.das2.qds.MutablePropertyDataSet ds ) → void

add QUBE property to dataset, maybe verifying that it is a qube. This is intended to reduce code that builds datasets, not to verify that a dataset is a qube.

Parameters

ds - the dataset

Returns:

void (returns nothing)

search for examples view on GitHub view source


as2DArrayOfDoubles

as2DArrayOfDoubles( QDataSet d ) → double

convert the QDataSet to an array. Units and fill are ignored...

Parameters

d - the rank 2 dataset

Returns:

2-D array of doubles

search for examples view on GitHub view source


asArrayOfDoubles

asArrayOfDoubles( QDataSet d ) → double

convert the QDataSet to an array. Units and fill are ignored...

Parameters

d - the rank 1 dataset.

Returns:

an array of doubles

search for examples view on GitHub view source


asDataSet

asDataSet( org.das2.datum.DatumVector dv ) → QDataSet

return the rank 1 dataset equivalent to the DatumVector

Parameters

dv -

Returns:

rank 1 QDataSet.

search for examples view on GitHub view source


asDatum

asDatum( org.das2.qds.RankZeroDataSet ds ) → Datum

Returns:

org.das2.datum.Datum

search for examples view on GitHub view source


asDatumRange

asDatumRange( QDataSet ds, boolean sloppy ) → DatumRange

return the DatumRange equivalent of this 2-element, rank 1 bins dataset.

Parameters

ds - a rank 1, 2-element bins dataset.
sloppy - true indicates we don't check BINS_0 property.

Returns:

an equivalent DatumRange

search for examples view on GitHub view source


asDatumVector

asDatumVector( QDataSet ds ) → DatumVector

return DatumVector, which is a 1-d array of Datums.

Parameters

ds - a rank 1 QDataSet

Returns:

a DatumVector

search for examples view on GitHub view source


bestFormatter

bestFormatter( QDataSet datums ) → DatumFormatter

return a DatumFormatter that can accurately format all of the datums in the dataset. The goal is to identify a formatter which is also efficient, and doesn't waste an excess of digits. This sort of code is often needed, and is also found in:

TODO: make one code for this. TODO: there also needs to be an optional external context ('2017-03-15') so that 'HH:mm' is a valid response. See sftp://jbf@jfaden.net/home/jbf/ct/autoplot/script/development/bestDataSetFormatter.jy

Parameters

datums - a rank 1 dataset, or if rank>1, then return the formatter for a slice.

Returns:

DatumFormatter for the dataset.

search for examples view on GitHub view source


binarySearch

binarySearch( QDataSet ds, double key, int low, int high ) → int

perform a binary search for key within ds, constraining the search to between low and high.

Parameters

ds - a rank 1 monotonic dataset.
key - the value to find.
low -
high -

Returns:

a positive index of the found value or -index-1 the insertion point.

search for examples view on GitHub view source


bundleNames

bundleNames( QDataSet ds ) → String

return the name for each column of the bundle. This simply calls SemanticOps.getComponentNames.

Parameters

ds - dataset, presumably with BUNDLE_1 property.

Returns:

array of names.

search for examples view on GitHub view source


bundleWeightsDataSet

bundleWeightsDataSet( QDataSet ds ) → QDataSet

special weightsDataSet for when there is a bundle, and each component could have its own FILL_VALID and VALID_MAX. Each component gets its own weights dataset in a JoinDataSet.

Parameters

ds - rank 2 bundle dataset

Returns:

dataset with the same geometry but a weightsDataSet of each bundled dataset.

search for examples view on GitHub view source


canonizeFill

canonizeFill( QDataSet ds ) → WritableDataSet

Iterate through the dataset, changing all points outside of validmin, validmax and with zero weight to fill=-1e31. VALID_MIN and VALID_MAX properties are cleared, and FILL_VALUE is set to -1e31. If the dataset is writable, then the dataset is modified.

Parameters

ds - rank N QUBE dataset.

Returns:

ds with same geometry as ds.

search for examples view on GitHub view source


checkListOfIndeces

checkListOfIndeces( QDataSet ds, QDataSet indices ) → void

verify that the indeces really are indeces, and a warning may be printed if the indeces don't appear to match the array by looking at the MAX_VALUE property of the indeces.

Parameters

ds - the dataset.
indices - the indeces which refer to a subset of dataset.

Returns:

void (returns nothing)

search for examples view on GitHub view source


checkQube

checkQube( QDataSet ds ) → boolean

check to see if a dataset really is a qube, even if there is a rank 2 dep1. Note this ignores BUNDLE_1 property if there is a DEPEND_1. This was motivated by the fftPower routine, which returned a rank 2 DEPEND_1, but is typically constant, and RBSP/ECT datasets that often have rank 2 DEPEND_1s that are constant. This will putProperty(QDataSet.QUBE,Boolean.TRUE) when the dataset really is a qube, or Boolean.FALSE if is clearly not a qube.

Parameters

ds - any dataset

Returns:

true if the dataset really is a qube.

search for examples view on GitHub view source


closest

closest( QDataSet ds, double d, int guess ) → int

return the index of the closest value in ds to d, using guess as a starting point. This implementation ignores guess, but wise clients will supply it as a parameter.

Parameters

ds - a rank 1, monotonic dataset.
d - the value to find.
guess - a guess at a close index, or -1 if no guess should be made. In this case, a binary search is performed.

Returns:

index of the closest.

search for examples view on GitHub view source


closestIndex

closestIndex( QDataSet ds, Datum datum ) → int

returns the index of the closest index in the data. This supports rank 1 datasets, and rank 2 bins datasets where the bin is min,max.

Parameters

ds - tags dataset
datum - the location to find

Returns:

the index of the closest point.

search for examples view on GitHub view source


contextAsString

contextAsString( QDataSet ds ) → String

provide the context as a string, for example to label a plot. The dataset CONTEXT_i properties are inspected, each of which must be one of:

Here a comma is used as the delimiter.

Parameters

ds - the dataset containing context properties which are rank 0 datums or rank 1 datum ranges.

Returns:

a string describing the context.

search for examples view on GitHub view source


convertTo

convertTo( QDataSet ds, Units u ) → QDataSet

convert the dataset to the given units.

Parameters

ds - the dataset
u - new Units

Returns:

equivalent dataset with the new units.

search for examples view on GitHub view source


copyDimensionProperties

copyDimensionProperties( QDataSet source, org.das2.qds.MutablePropertyDataSet dest ) → void

Copy over all the dimension properties, including: UNITS, FORMAT, SCALE_TYPE, TYPICAL_MIN, TYPICAL_MAX, VALID_MIN, VALID_MAX, FILL_VALUE, NAME, LABEL, TITLE, USER_PROPERTIES These are dimension properties, as opposed to structural see dimensionProperties() for a list of dimension properties. TODO: This DOES NOT support join datasets yet.

Parameters

source -
dest -

Returns:

void (returns nothing)

search for examples view on GitHub view source


correlativeProperties

correlativeProperties( ) → String

properties that go along with the zeroth index. These are all QDataSets with dimensions compatible with the datasets. If you trim the dataset, then these must be trimmed as well.

Returns:

the properties that go along with the zeroth index

search for examples view on GitHub view source


courserCadence

courserCadence( org.das2.qds.RankZeroDataSet yTagWidth0, org.das2.qds.RankZeroDataSet yTagWidth1 ) → RankZeroDataSet

return the courser cadence of the two cadences. Das2's AverageTableRebinner needs to get the coursest of all the ytags.

Parameters

yTagWidth0 - rank 0 dataset that is one cadence (e.g. 84 sec)
yTagWidth1 - rank 0 dataset that is the second cadence (e.g. 70 sec)

Returns:

the courser of the two cadences. (e.g. 84 sec)

search for examples view on GitHub view source


dimensionProperties

dimensionProperties( ) → String

return the list of properties that pertain to the dimension that dataset values exist. These are the properties that survive through most operations. For example, if you flattened the dataset, what properties would still exist? If you shuffled the data? These are not structural properties like DEPEND_0, BUNDLE_1, etc. Note that BUNDLE_1 will carry dimension properties as well.

Returns:

java.lang.String[]

search for examples view on GitHub view source


firstValidPoint

firstValidPoint( QDataSet ds ) → QDataSet

returns the first valid point found in a dataset, or null if no such point is found.

Parameters

ds - non-bundle dataset.

Returns:

rank zero dataset containing the first valid point, or null.

search for examples view on GitHub view source


getCadenceWaveform

getCadenceWaveform( QDataSet ds ) → RankZeroDataSet

return the cadence between measurements of a waveform dataset. This is different than the cadence typically quoted, which is the cadence between waveform records.

Parameters

ds -

Returns:

the cadence

search for examples view on GitHub view source


getDimensionProperties

getDimensionProperties( QDataSet ds, java.util.Map def ) → Map

return just the properties attached to the dataset, like UNITS and SCALE_TYPE, and not like DEPEND_x, etc.

Parameters

ds - the dataset
def - default values or null.

Returns:

a map of all the properties.

See Also:

dimensionProperties()


search for examples view on GitHub view source


getNextIndex

getNextIndex( QDataSet ds, Datum datum ) → int

returns the first column that is after the given datum. Note the if the datum identifies (==) an xtag, then the previous column is returned.

Parameters

ds - the dataset
datum - a datum in the same units of the dataset.

Returns:

int

search for examples view on GitHub view source


getNextIndexStrict

getNextIndexStrict( QDataSet ds, Datum datum ) → Integer

Returns the index of the value which is greater than the value less of the datum. Note for rank 2 bins, the first bin which has an beginning less than the datum.

Parameters

ds - rank 1 monotonic tags, or rank 2 bins.
datum - a datum of the same or convertible units.

Returns:

the index, or null (None).

search for examples view on GitHub view source


getNextInterval

getNextInterval( QDataSet ds, DatumRange dr0 ) → DatumRange

return the next interval (typically time) containing data, centered on data, with the roughly the same width.

Parameters

ds - the dataset
dr0 - the current interval

Returns:

the next interval

search for examples view on GitHub view source


getPreviousIndex

getPreviousIndex( QDataSet ds, Datum datum ) → int

returns the first index that is before the given datum, or zero if no data is found before the datum. PARV! if the datum identifies (==) an xtag, then the previous column is returned.

Parameters

ds - the dataset
datum - a datum in the same units of the dataset.

Returns:

the index

search for examples view on GitHub view source


getPreviousIndexStrict

getPreviousIndexStrict( QDataSet ds, Datum datum ) → Integer

Returns the index of the value which is less than the value less of the datum. Note for rank 2 bins, the first bin which has an end less than the datum.

Parameters

ds - rank 1 monotonic tags, or rank 2 bins.
datum - a datum of the same or convertible units.

Returns:

the index, or null (None).

search for examples view on GitHub view source


getPreviousInterval

getPreviousInterval( QDataSet ds, DatumRange dr0 ) → DatumRange

return the previous interval (typically time) containing data, centered on data, with the roughly the same width.

Parameters

ds - the dataset
dr0 - the current interval

Returns:

the previous interval

search for examples view on GitHub view source


getPropertyClass

getPropertyClass( String name ) → Class

return the class for the property, to support Jython.

Parameters

name - the property name, e.g. QDataSet.TITLE

Returns:

String.class

See Also:

getPropertyType(java.lang.String)


search for examples view on GitHub view source


getStringValue

getStringValue( QDataSet ds, double value, int i ) → String

return the value, which gets units from index i. from rank 1 bundle dataset.

Parameters

ds - the dataset providing units and format information.
value - double value from the dataset
i - the index of the value

Returns:

java.lang.String

search for examples view on GitHub view source


getUserProperty

getUserProperty( QDataSet ds, String name ) → Object

return the "User" property, which allow for extensions of the data model that aren't used. This returns the property "name" under the name USER_PROPERTIES, which must either be null or a Map<String,Object>.

Parameters

ds - The dataset containing the property.
name - The name of the user property.

Returns:

java.lang.Object

search for examples view on GitHub view source


globalProperties

globalProperties( ) → String

properties that describe the dataset itself, rather than those of a dimension or structural properties.

Returns:

the properties that describe the dataset itself

search for examples view on GitHub view source


guessCadence

guessCadence( QDataSet xds, QDataSet yds ) → QDataSet

return the cadence for the given x tags. The goal will be a rank 0 dataset that describes the intervals, but this will also return a rank 1 dataset when multiple cadences are found. The yds values for each xds value can also be set, specifying where the x values can be ignored because of fill. When this is. TODO: this needs review.

Parameters

xds - the x tags, which may not contain fill values for non-null result.
yds - the y values, which if non-null is only used for fill values. This is only used if it is rank 1.

Returns:

rank 0 or rank 1 dataset.

search for examples view on GitHub view source


guessCadenceNew

guessCadenceNew( QDataSet xds, QDataSet yds ) → RankZeroDataSet

returns a rank 0 dataset indicating the cadence of the dataset. Using a dataset as the result allows the result to indicate SCALE_TYPE and UNITS. History:

Parameters

xds - the x tags, which may not contain fill values for non-null result.
yds - the y values, which if non-null is only used for fill values. This is only used if it is rank 1.

Returns:

null or the cadence in a rank 0 dataset. The following may be properties of the result:

search for examples view on GitHub view source


indexGenDataSet

indexGenDataSet( int n ) → MutablePropertyDataSet

creates a dataset of integers 0,1,2,...,n-1.

Parameters

n - the bound

Returns:

the dataset

search for examples view on GitHub view source


inferBins

inferBins( QDataSet yds ) → QDataSet

This is the one code to infer bin boundaries when only the centers are available. This uses centers of adjacent data, and extrapolates to get the edge boundaries to create an acceptable limit. When the data is log-spaced, the centers are done in the ratiometric space. Small (<1000 element) datasets will be sorted if necessary.

Parameters

yds - rank 1 dataset.

Returns:

rank 2 bins dataset.

search for examples view on GitHub view source


inferBinsRank2

inferBinsRank2( QDataSet ydss ) → QDataSet

infer the bins for the rank 2 ytags. This was first used with Juno high-rate data, where the ytags follow the FCE implied by the magnetic field detector.

Parameters

ydss - rank 2 dataset[n,m]

Returns:

two-element array of rank 2 datasets[n,m], where 0 is the min and 1 is the max.

search for examples view on GitHub view source


isConstant

isConstant( QDataSet ds ) → boolean

return true if each record of DEPEND_0 is the same. Rank 0 datasets are trivially constant. TODO: ds.slice(i) can be slow because equivalent does so much with the metadata.

Parameters

ds - any dataset

Returns:

true if the dataset doesn't change with DEPEND_0 or is rank 0.

search for examples view on GitHub view source


isDimensionProperty

isDimensionProperty( String name ) → boolean

return true if the property name is a valid dimension property like "UNITS" or "FORMAT". See dimensionProperties().

Parameters

name - property name to test

Returns:

true if the property is a dimension property.

search for examples view on GitHub view source


isInheritedProperty

isInheritedProperty( String prop ) → boolean

true if the property is one that is global and is relevant throughout the dataset, such as a title or the units. property( "TITLE",0,0 ) often returns property("TITLE"), but property( "DEPEND_0",0,0 ) should never return property("DEPEND_0"). This is false, for example, for DEPEND_1.

Parameters

prop - the property name.

Returns:

true if the property is inherited

search for examples view on GitHub view source


isLogSpacing

isLogSpacing( QDataSet ds ) → boolean

return true if the data appears to have log spacing. The data is assumed to be monotonically increasing or decreasing.

Parameters

ds - rank 1 dataset.

Returns:

true if the data is roughly log spaced.

search for examples view on GitHub view source


isMonotonicAndIncreasing

isMonotonicAndIncreasing( QDataSet ds ) → boolean

returns true if the dataset is monotonically increasing and does not contain repeat values. An empty dataset is not monotonic. The dataset may contain fill data, only the non-fill portions are considered.

Parameters

ds - the rank 1 dataset with physical units.

Returns:

true when the dataset is monotonically increasing.

See Also:

QDataSet#MONOTONIC
org.das2.qds.ArrayDataSet#monotonicSubset(org.das2.qds.ArrayDataSet)
isMonotonic(QDataSet)


search for examples view on GitHub view source


isMonotonicAndIncreasingQuick

isMonotonicAndIncreasingQuick( QDataSet ds ) → boolean

quickly determine, with high accuracy, if data is monotonic. This should be a constant-time operation, and be extremely unlikely to fail.

Parameters

ds -

Returns:

true if the data does pass quick tests for monotonic increasing.

See Also:

isMonotonicAndIncreasing(QDataSet)
QDataSet#MONOTONIC
Ops#ensureMonotonicAndIncreasingWithFill(QDataSet)


search for examples view on GitHub view source


isMonotonicQuick

isMonotonicQuick( QDataSet ds ) → boolean

quickly determine, with high accuracy, if data is monotonic (repeated values allowed). This should be a constant-time operation, and be extremely unlikely to fail.

Parameters

ds -

Returns:

true if the data does pass quick tests for monotonic.

See Also:

isMonotonicAndIncreasing(QDataSet)
QDataSet#MONOTONIC


search for examples view on GitHub view source


isQube

isQube( QDataSet ds ) → boolean

test to see that the dataset is a qube. TODO: this all needs review.

Parameters

ds - QDataSet of any rank.

Returns:

true if the dataset is a qube.

search for examples view on GitHub view source


kmeansCadence

kmeansCadence( QDataSet xds, int n ) → QDataSet

use K-means algorithm to find N means in a rank 1 dataset.

Parameters

xds - dataset containing data from N normal distributions
n - number of divisions.

Returns:

dataset containing the index for each point.

search for examples view on GitHub view source


makeValid

makeValid( org.das2.qds.MutablePropertyDataSet ds ) → void

throw out DEPEND and PLANE to make dataset valid.

Parameters

ds -

Returns:

void (returns nothing)

search for examples view on GitHub view source


maybeCopyRenderType

maybeCopyRenderType( QDataSet source, org.das2.qds.MutablePropertyDataSet dest ) → void

copy over the render type, if it is still appropriate. This nasty bit of code was introduced to support LANL data, where high-rank data is preferably plotted as a spectrogram, but can be plotted as a stack of lineplots.

Parameters

source -
dest -

Returns:

void (returns nothing)

search for examples view on GitHub view source


nLargest

nLargest( QDataSet set, int n ) → QDataSet

return the value of the nth biggest item. This keeps n values in memory.

Parameters

set - rank 1 dataset containing comparable data.
n - the number of items to find

Returns:

the n largest elements, sorted.

search for examples view on GitHub view source


product

product( int[] qube ) → int

returns 1 for zero-length qube, the product otherwise.

Parameters

qube - int array

Returns:

the product of the elements of the array

search for examples view on GitHub view source


propertyNames

propertyNames( ) → String

Return the names of non-structural properties of the dataset, like the UNITS and CADENCE. These are the dimensionProperties, plus others specific to the dataset, such as CADENCE and DELTA_PLUS.

Returns:

the names of non-structural properties of the dataset, like the UNITS and CADENCE.

search for examples view on GitHub view source


putProperties

putProperties( java.util.Map properties, org.das2.qds.MutablePropertyDataSet ds ) → void

copy all properties into the dataset by iterating through the map. Properties that are equal to null are not copied, since null is equivalent to the property not found.

Parameters

properties - the properties
ds - the mutable property dataset, which is still mutable.

Returns:

void (returns nothing)

See Also:

getProperties(QDataSet)


search for examples view on GitHub view source


qubeDims

qubeDims( QDataSet ds ) → int

provides a convenient way of indexing qubes, returning an int[] of length ds.rank() containing each dimension's length, or null if the dataset is not a qube.

Parameters

ds -

Returns:

int[] of length ds.rank() containing each dimension's length, or null if the dataset is not a qube.

search for examples view on GitHub view source


rangeOfMonotonic

rangeOfMonotonic( QDataSet ds ) → int

returns the indeces of the min and max elements of the monotonic dataset. This uses DataSetUtil.isMonotonic() which would be slow if MONOTONIC is not set.

Parameters

ds - monotonic, rank 1 dataset.

Returns:

the indeces [min,max] note max is inclusive.

See Also:

org.das2.qds.ops.Ops#extent which returns the range containing any data. which returns the range containing any data.
isMonotonic(QDataSet) which must be true


search for examples view on GitHub view source


replicateDataSet

replicateDataSet( int n, double value ) → MutablePropertyDataSet

creates a dataset with the given cadence, start and length.

Parameters

n - the number of elements
value - the value for each element

Returns:

the dataset

search for examples view on GitHub view source


samePopulation

samePopulation( QDataSet ds1, QDataSet ds2 ) → boolean

true if the two datasets appear to be from the same population.

Parameters

ds1 - first dataset
ds2 - second dataset

Returns:

true if the two datasets appear to be from the same population

search for examples view on GitHub view source


sliceProperties

sliceProperties( QDataSet ds, int index, java.util.Map result ) → Map

return properties attached to the slice at index. Note the slice implementations use this, and this only returns properties from dimensionProperties(). http://autoplot.org//QDataSet#20150514 Note this does not look at BUNDLE_1 properties. TODO: consider this.

Parameters

ds - the dataset to slice.
index - index to slice at.
result - a map to insert the new properties, or null if a new one should be created.

Returns:

a map of properties attached to the slice at index

search for examples view on GitHub view source


statsString

statsString( QDataSet ds ) → String

return a human readable statistical representation of the dataset. Currently this is the mean, stddev ad number of points.

Parameters

ds - the data

Returns:

return a human readable statistical representation

search for examples view on GitHub view source


sum

sum( int[] qube ) → int

returns 0 for zero-length qube, the sum otherwise.

Parameters

qube - int array

Returns:

the sum of the elements of the array

search for examples view on GitHub view source


tagGenDataSet

tagGenDataSet( int n, double start, double cadence ) → MutablePropertyDataSet

creates a dataset with the given cadence, start and length. This is danger code, because the CADENCE must be reset if the UNITS are reset. use tagGenDataSet( int n, final double start, final double cadence, Units units ) if units are going to be specified.

Parameters

n - the number of elements
start - the value for the first element.
cadence - the step size between elements

Returns:

the dataset

search for examples view on GitHub view source


toBundleDs

toBundleDs( QDataSet labels ) → MutablePropertyDataSet

make a proper bundle ds from a simple bundle containing ordinal units This assumes that labels is a unique set of labels. See http://autoplot.org/QDataSet#DataSet_Properties under BUNDLE_1. See DataSetOps.unbundle

Parameters

labels -

Returns:

a BundleDescriptor to be set as BUNDLE_i. See BundleDataSet

search for examples view on GitHub view source


toSparkline

toSparkline( QDataSet ds, QDataSet extent, boolean bar ) → String

Make a unicode spark line http://www.ssec.wisc.edu/~tomw/java/unicode.html. This should be for human consumption, because future versions may include data reduction and doubling up characters. See commented code in MetadataPanel.histStr. (I knew I had done this before...)

Parameters

ds - the rank N (typically 1) dataset
extent - None or the range, see Ops.extent(ds)
bar - true indicates bars should be used instead of scatter

Returns:

string that is a sparkline.

search for examples view on GitHub view source


totalLength

totalLength( QDataSet ds ) → int

return the total number of values in the dataset. For qubes this is the product of the dimension lengths, for other datasets we create a dataset of lengths and total all the elements.

Parameters

ds -

Returns:

the number of values in the dataset.

search for examples view on GitHub view source


trimProperties

trimProperties( QDataSet ds, int start, int stop ) → Map

help out implementations of the QDataSet.trim() command. This does the dimension properties and geometric properties like DEPEND_0 and DELTA_PLUS. This also checks for indexed properties, which are NAME__i.

Parameters

ds - the dataset with properties to trim.
start - start index of trim operation
stop - exclusive stop index of the trim operation.

Returns:

the properties of ds, trimmed to the indices.

search for examples view on GitHub view source


validPoints

validPoints( QDataSet ds ) → QDataSet

return just the valid points of the dataset.

Parameters

ds - a dataset rank > 0.

Returns:

the valid points of the dataset in a rank 1 dataset.

search for examples view on GitHub view source


xTagBinarySearch

xTagBinarySearch( QDataSet ds, Datum datum, int low, int high ) → int

returns the index of a tag, or the (-(insertion point) - 1). (See Arrays.binarySearch)

Parameters

ds - monotonically increasing data.
datum - value we are looking for
low - inclusive lower bound of the search
high - inclusive upper bound of the search

Returns:

the index of a tag, or the (-(insertion point) - 1)

search for examples view on GitHub view source