Search in sources :

Example 1 with ConstantColumnView

use of org.activityinfo.model.query.ConstantColumnView in project activityinfo by bedatadriven.

the class SearchFunction method columnApply.

@Override
public ColumnView columnApply(int numRows, List<ColumnView> arguments) {
    ColumnView substring = arguments.get(0);
    ColumnView string = arguments.get(1);
    ColumnView startIndex;
    if (arguments.size() == 3) {
        startIndex = arguments.get(3);
    } else {
        startIndex = new ConstantColumnView(numRows, 1d);
    }
    double[] result = new double[numRows];
    for (int i = 0; i < numRows; i++) {
        result[i] = apply(substring.getString(i), string.getString(i), startIndex.getDouble(i));
    }
    return new DoubleArrayColumnView(result);
}
Also used : ColumnView(org.activityinfo.model.query.ColumnView) DoubleArrayColumnView(org.activityinfo.model.query.DoubleArrayColumnView) ConstantColumnView(org.activityinfo.model.query.ConstantColumnView) DoubleArrayColumnView(org.activityinfo.model.query.DoubleArrayColumnView) ConstantColumnView(org.activityinfo.model.query.ConstantColumnView)

Aggregations

ColumnView (org.activityinfo.model.query.ColumnView)1 ConstantColumnView (org.activityinfo.model.query.ConstantColumnView)1 DoubleArrayColumnView (org.activityinfo.model.query.DoubleArrayColumnView)1