package org.das2.qds; /** * QFunctions try to recycle as much of the QDataSet interface as possible to * define functions. Functions take N parameters as input and result in M parameter * output. The N parameters are passed into value as a rank 1 bundle QDataSet, or rank 0 * dataset when there is just one input. * The M parameter output is returned in a rank 1 bundle dataset. The method * exampleInput returns an example input that allows for discovery of the function. * * Implementations will generally extend AbstractQFunction, which implements * values() and exampleOutput(). * * Goals: *
* slice(0) is the first argument, slice(1) would be the second, etc. * This would be a bundle. * * Note, for functions that have only one argument, like F(T)→[R,MLT,MLAT], this * may return a rank 0 dataset. Clients should pass a dataset to the value method a * dataset with the same geometry. * @return rank 1 bundle of N elements, or rank 0 for functions when the function has just one parameter. */ QDataSet exampleInput(); /** * Discover an example of output. Result is a rank 1 bundle QDataSet. This * was introduced to support QFunctions where it would be expensive to calculate * an input that would result in a meaningful output. It's assumed that many * implementations will simply be: **QFunction ff= TestFunction(); *ff.exampleInput().length(); // how many parameters the function takes *QDataSet bds= ff.exampleInput().property( QDataSet.BUNDLE_0 ); *bds.slice(0).property( QDataSet.UNITS ) // function should handle convertible units (e.g. TimeAxes Ephemeris). *bds.slice(0).property( QDataSet.VALID_MIN ) // absolute limits of domain of the function *bds.slice(0).property( QDataSet.VALID_MAX ) *bds.slice(0).property( QDataSet.TYPICAL_MIN ) // domain of the function parameter *bds.slice(0).property( QDataSet.TYPICAL_MAX ) *bds.slice(0).property( QDataSet.CADENCE ) // granularity of the function parameter *bds.slice(0).property( QDataSet.LABEL ) // label for the parameter *
* @return rank 1 bundle of M elements. */ QDataSet exampleOutput(); }*value( exampleInput() ); *