public RRaw op(RRaw a, RRaw b, ASTNode ast) { int na = a.size(); int nb = b.size(); int[] dimensions = Arithmetic.resultDimensions(ast, a, b); Names names = Arithmetic.resultNames(ast, a, b); if (na == 0 || nb == 0) { return RRaw.EMPTY; } int n = (na > nb) ? na : nb; byte[] content = new byte[n]; int ai = 0; int bi = 0; for (int i = 0; i < n; i++) { byte araw = a.getRaw(ai++); if (ai == na) { ai = 0; } byte braw = b.getRaw(bi++); if (bi == nb) { bi = 0; } content[i] = op(araw, braw); } if (ai != 0 || bi != 0) { RContext.warning(ast, RError.LENGTH_NOT_MULTI); } return RRaw.RRawFactory.getFor(content, dimensions, names); }
public RLogical op(RLogical a, RLogical b, ASTNode ast) { int na = a.size(); int nb = b.size(); int[] dimensions = Arithmetic.resultDimensions(ast, a, b); Names names = Arithmetic.resultNames(ast, a, b); if (na == 0 || nb == 0) { return RLogical.EMPTY; } int n = (na > nb) ? na : nb; int[] content = new int[n]; int ai = 0; int bi = 0; for (int i = 0; i < n; i++) { int alog = a.getLogical(ai++); if (ai == na) { ai = 0; } int blog = b.getLogical(bi++); if (bi == nb) { bi = 0; } content[i] = op(alog, blog); } if (ai != 0 || bi != 0) { RContext.warning(ast, RError.LENGTH_NOT_MULTI); } return RLogical.RLogicalFactory.getFor(content, dimensions, names); }