All Downloads are FREE. Search and download functionalities are using the official Maven repository.

water.udf.CFunc1Task Maven / Gradle / Ivy

The newest version!
package water.udf;

import org.junit.Ignore;

import water.fvec.Chunk;
import water.fvec.NewChunk;

@Ignore("Support for tests, but no actual tests here")
public class CFunc1Task extends CFuncTask {

  private final int len;
  private final int ofs;

  public CFunc1Task(CFuncRef cFuncRef, int ofs, int len) {
    super(cFuncRef);
    this.len = len;
    this.ofs = ofs;

  }
  public CFunc1Task(CFuncRef cFuncRef, int len) {
    this(cFuncRef, 0, len);
  }

  @Override
  public void map(Chunk c[], NewChunk nc) {
    CBlock block = new CBlock(c, ofs, len);
    for(int i = 0; i < block.rows(); i++) {
      nc.addNum(func.apply(block.row(i)));
    }
  }

  @Override
  protected Class getFuncType() {
    return CFunc1.class;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy