public BooleanDataBuffer copyTo()

in ndarray/src/main/java/org/tensorflow/ndarray/impl/buffer/misc/BooleanArrayDataBuffer.java [66:99]


  public BooleanDataBuffer copyTo(DataBuffer<Boolean> dst, long size) {
    Validator.copyToArgs(this, dst, size);
    return dst.accept(new DataStorageVisitor<BooleanDataBuffer>() {

      @Override
      public BooleanDataBuffer visit(boolean[] array, int arrayOffset, int arrayLength) {
        System.arraycopy(values, offset, array, arrayOffset, (int)size);
        return BooleanArrayDataBuffer.this;
      }

      @Override
      public BooleanDataBuffer visit(BitSet bitSet, int bitSetOffset, long numBits) {
        for (int idx = 0; idx < size; ++idx) {
          bitSet.set(idx + bitSetOffset, values[idx + offset]);
        }
        return BooleanArrayDataBuffer.this;
      }

      @Override
      public BooleanDataBuffer fallback() {
        if (dst instanceof BooleanDataBuffer) {
          BooleanDataBuffer booleanDst = (BooleanDataBuffer)dst;
          for (int idx = 0; idx < size; ++idx) {
            booleanDst.setBoolean(values[idx + offset], idx);
          }
        } else {
          for (int idx = 0; idx < size; ++idx) {
            dst.setObject(values[idx + offset], idx);
          }
        }
        return BooleanArrayDataBuffer.this;
      }
    });
  }