Search in sources :

Example 1 with BooleanColumnView

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

the class BinaryBooleanOperator method columnApply.

@Override
public ColumnView columnApply(int numRows, List<ColumnView> arguments) {
    checkArity(arguments, 2);
    ColumnView a = arguments.get(0);
    ColumnView b = arguments.get(1);
    if (a.numRows() != b.numRows()) {
        throw new FormulaSyntaxException("Arguments must have the same number of rows");
    }
    int[] result = new int[a.numRows()];
    for (int i = 0; i < result.length; i++) {
        int ai = a.getBoolean(i);
        int bi = b.getBoolean(i);
        result[i] = apply(ai, bi);
    }
    return new BooleanColumnView(result);
}
Also used : FormulaSyntaxException(org.activityinfo.model.formula.diagnostic.FormulaSyntaxException) ColumnView(org.activityinfo.model.query.ColumnView) BooleanColumnView(org.activityinfo.model.query.BooleanColumnView) BooleanColumnView(org.activityinfo.model.query.BooleanColumnView)

Aggregations

FormulaSyntaxException (org.activityinfo.model.formula.diagnostic.FormulaSyntaxException)1 BooleanColumnView (org.activityinfo.model.query.BooleanColumnView)1 ColumnView (org.activityinfo.model.query.ColumnView)1